css-modules / css-modulesify

A browserify plugin to load CSS Modules
MIT License
403 stars 47 forks source link

Hot loading #30

Open joshwnj opened 9 years ago

joshwnj commented 9 years ago

As someone once wisely said to me, "if you ain't hot-loading, you ain't coding".

Let's make it happen. I'd like to collect some workflow examples and if there are any changes required, bundle them in as part of the 1.0 release (#29)

joeybaker commented 9 years ago

http://www.browsersync.io/ for css-reloading. How do you envision css-modulesify handling the task?

joshwnj commented 9 years ago

Will take a look at browsersync, thanks. In this case we need to consider a few more edge cases than normal, since an edit to a css module may also need to trigger a rebuild / reload of a js module (if the export tokens changed).

joeybaker commented 9 years ago

yea, I have a setup where this is done with https://github.com/mattdesl/budo/ + browsersync, I'd like to get it open sourced, but again… I won't have time for a few weeks :\

joshwnj commented 9 years ago

cool! well if you have time to put up a demo somewhere I'd love to see

joeybaker commented 9 years ago

This is somewhat custom to what we're doing, but it should give you an idea of how we setup budo + browsersync for a universal hot-reloading script: https://gist.github.com/joeybaker/b7324e8519952b9de76a

neurosnap commented 8 years ago

Any updates on this?

joshwnj commented 8 years ago

There are a few things that need to change in order to get css-modulesify working with browserify-hmr. Rather than hacking too much on this one I've been experimenting with a rewrite: https://github.com/joshwnj/cmify

You can also take a look at a basic example of hot reloading here: https://github.com/joshwnj/css-modules-starter-kit/tree/hot-reload

There are a few more things I need to look into first but there's a possibility that we'll be able to bring across these improvements to a major-version update of css-modulesify.