GithubHelp home page GithubHelp logo

Comments (4)

serapath avatar serapath commented on May 3, 2024

I'm interested too learn about that too :-) But jss shows you can also manage stylesheets, not just inline-styles from javascript.

@gaearon
what do you think about jss and/or css-modules in combination with things like hyperstyles

from ama.

LorbusChris avatar LorbusChris commented on May 3, 2024

+1 :)

from ama.

tychota avatar tychota commented on May 3, 2024

+1:)

from ama.

gaearon avatar gaearon commented on May 3, 2024

It's hard to say! I don't have a clear preference right now because I haven't worked on a product for almost half a year, and we were just barely starting to sometimes use inline styles when I left, so I haven't really played with these solutions enough.

I think, code-wise, I prefer the inline styles model. It doesn't need to correspond to inline styles in the implementation: for example jsxstyle treats CSS as an implementation detail, and it works as inline styles in development, but can be extracted into a CSS bundle in production thanks to static analysis. Using static analysis for this is appealing to me because it lets you write code using a single language (JS), but still perform tasks like auto-prefixing, optimization and dead-code elimination at the compile time.

There are, however, tradeoffs and inconveniences you already know: editing or debugging inline styles in browser isn't very nice, it's harder to do CSS animations or media queries. I think, as we get better JavaScript APIs for these things, and more frameworks start adopting React's declarative rendering model, inline styles (or, really, specify-as-inline-styles-but-compile-to-whatever) solutions will become mainstream. In the meantime, CSS modules strike a pretty good balance between the benefits of style isolation and the incidental complexity introduced by many inline style tools. But I'm also looking forward to more tools like jsxstyle.

from ama.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.