-
-
Notifications
You must be signed in to change notification settings - Fork 93
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
Add support for disabling style-loader via inline_css: false. #69
Conversation
README.md
Outdated
@@ -671,7 +671,9 @@ development: | |||
port: 3035 | |||
``` | |||
|
|||
If you have `hmr` turned to true, then the `stylesheet_pack_tag` generates no output, as you will want to configure your styles to be inlined in your JavaScript for hot reloading. During production and testing, the `stylesheet_pack_tag` will create the appropriate HTML tags. | |||
If you have `hmr` turned to true and `inline_styles` is not false, then the `stylesheet_pack_tag` generates no output, as you will want to configure your styles to be inlined in your JavaScript for hot reloading. During production and testing, the `stylesheet_pack_tag` will create the appropriate HTML tags. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cheald Should inline_styles
be incline_css
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you're right. Good catch!
Two things @cheald @justin808
|
style-loader is still how people are "used" to CSS HMR in Webpack. mini-css-extract-plugin's HMR functionality a) reloads the existing CSS and b) patches in the changed CSS on top of it, which is more data transferred and may cause a brief FOUC. In both cases, Webpack's compilation time doesn't seem to change (as one would expect, since the dirty files don't change, and neither style-loader or mini-css-extract-plugin are particularly heavy). style-loaderbenefits
drawbacks
mini-extract-css-plugin:Benefits
Drawbacks
I'd likely opt to just use mini-extract-css-plugin all the time, but I can see why others may want to retain the style-loader path. |
Thanks @cheald Good writeup! Makes sense for this to be opt-in behaviour then. Might be something that could be recommended approach though, I also hit issues of missing cc @justin808 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cheald LGTM - can you add a changelog entry also under unreleased? https://github.com/shakacode/shakapacker/blob/master/CHANGELOG.md#unreleased
Done and done. |
…ll cause only mini-css-extract-plugin to be used. See shakacode#68
48c2dbc
to
3472d80
Compare
FOUC = flash of unstyled content @justin808 :) Docs at |
@justin808 let's merge and I'll create a follow up with doc updates 👍 |
Hey guys, sorry about the delay on this. I've been out of pocket this week. I'm happy to submit another PR for the documentation if that's still needed. |
@cheald YES! Please do! I want to get that out, and then I'll make the release at the same time. |
This PR is for #68
This will cause style-loader to not be used if
inline_css: false
is set in the dev_server options. Any value other thanfalse
(includingnil
) will result in the current behavior.I have a test for the
inlining_css?
method, and I did manually test that this has the desired effect in my own application, but I'm not sure how to best wire up a test for it otherwise.