Closed ahdinosaur closed 8 years ago
Would you like to also provide some docs for such usage in readme? It would be really helpful.
my usage is still in progress, not sure how to explain it other than to use css-modules-require-hook
in node, use cssify
with options { "modules": true }
in browserify, and then require
your css modules and use them as className
in your react
components.
btw, @faergeek did you ever make any progress on writing to disk? that'd be helpful to get proper server-side rendering.
Not yet, I tried to use factor-bundle
, but have no success with that, it seems like that should be built into cssify
, what do you think?
maybe, but like you said before i wonder if it can be done as a separate module.
here's a crazy idea: a browserify plugin that runs the generated bundle on a temporary jsdom
, then extracts the total contents of any stylesheets that were created into a file (stream), hmm but also needs to somehow remove the code that added the stylesheets from the bundle. i think it'd be much easier if cssify
used insert-css
(as sheetify
does) so our plugin could search for calls to insert-css
, extract stylesheet contents from that function call, then remove the function call from the bundle. hmm.
We can't use insert-css
because we're supporting hot module replacement (using browserify-hmr) and AFAIK insert-css
does not support it. Anyway we have similar method for injection, but I don't think that it's the right way.
sweet the hot module replacement is great. is it possible extract browser.js into a separate module so process-css.js references it? i'd be happy to use it in sheetify as well, then we have something common to target for a global transform to extract stylesheets from a bundle.
css-modules-require-hook
defaults in development to using this scopeName.pull request fixes render mismatch when doing "universal" / "isomorphic" React app.