-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HMR for CSS #188
Comments
No problem 😄 Ahh right I see. Did you checked this thread though? webpack-contrib/extract-text-webpack-plugin#30 and there is a PR too, but not merged - webpack-contrib/extract-text-webpack-plugin#457 You could also give this loader a try - https://github.com/shepherdwind/css-hot-loader and see if it works. As you see, there is a lot of gotchas involved so, I am not sure if its a good idea to add this check to core as this might change anytime. |
#264 addresses this 👍 |
@renchap I use this: module LayoutHelper
def webpack_dev_server_present?
Rails.env.development? && Net::HTTP.get(URI("http://localhost:8080")) ? true : false
rescue Errno::ECONNREFUSED
return false
end
end It does not try anything unless |
HMR has landed on master 🎉 |
First of all, thanks a lot @gauravtiwari for your work on integrating the non-JS assets management!
As I am using HMR with React, I am trying to enable it for CSS to avoid CSS changes to reload the whole page. To achieve this,
ExtractTextPlugin
needs to be replaced bystyle-loader
for development. Here are my changes tosass.js
:This works fine but I need to change my
stylesheet_pack_tag
calls to not occur during development because the CSS files are now embedded into the JS packs when I am serving the assets usingwebpack-dev-server
with HMR on, and the manifest file does not contain them.Currently I am using
but I dont find this very elegant.
Do you have an idea on how to correctly handle this? I was thinking about either an
asset_pack_exists?(name)
method to check if the CSS file is present, or an option to the pack tag helpers, likestylesheet_pack_tag "application", only_if_exists: true
.Any other or better ideas?
The text was updated successfully, but these errors were encountered: