Hacker News new | ask | show | jobs
by chrischen 2617 days ago
Generally CSS is loaded into your code where you require them but has to be extracted into a single bundle.

If you want to it truly be loaded into your code where you use it, then CSS-in-JS is the solution and does this for you.

It sounds like the main gripe you have is with syntax, and that's not really required with CSS-in-JS. The 'nightmare of nested js objetcts' can be hidden in the implementation. In fact, many libs (such as emotion) allow you to write CSS syntax using babel macros to preprocess this into javascript.