Re:CSS Modules
by andreypopp on Wednesday August 19, 2015 @05:13AM
(#10084398)
That (extraction) can be done (React Style does that) but for it to be consistent with JS semantics you need to evaluate code at build time because such template strings can contain interpolations from JS world.
Re:CSS Modules
by andrewingram on Wednesday August 19, 2015 @05:19AM
(#10084411)
Ah yes, forget about the interpolation issue. I knew there was a reason I stopped digging into it
I think you could actually go one step further and embed the stylesheet in the React component's module using a tagged template string, I haven't looked into how you'd get webpack to extract this into CSS files, but I'm sure it's possible.
Eg: https://gist.github.com/AndrewIngram/e3af5e8b70fd89a9a0d3