-
-
Notifications
You must be signed in to change notification settings - Fork 95
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
Option to not use style-loader #68
Comments
…ll cause only mini-css-extract-plugin to be used. See shakacode#68
Sure, I whipped something up. If you have further direction on what you'd like to see, I'm happy to further improve it. |
…ll cause only mini-css-extract-plugin to be used. See shakacode#68
* inline_css: false will cause only mini-css-extract-plugin to be used. See #68 * Fix readme and add inline_css to the config template
Ruby version: 2.5.0 @cheald just i've got a I've tried class Webpacker::Instance
def inlining_css?
false
end
end |
@matoni109 please see comments here: https://github.com/shakacode/shakapacker/pull/75/files |
@justin808 good to close! |
Ruby version: 2.7.4
Rails version: ~> 5.2.6
Webpacker version: 6.1.1
Desired behavior:
mini-css-extract-plugin is capable of HMR now. I'd like the ability to opt into just using it all the time, even when HMR is set in webpacker.yml. I'd like to get style-loader out of the dev pipeline so that my development and production environments more closely match, while retaining HMR. It turns out this isn't too hard!
Actual behavior:
Currently,
hmr: true
in webpacker.yml setsWebpack.inlining_css?
, which prevents stylesheet_pack_tag form emitting<link>
tags for CSS, on the assumption that style-loader is in play. I monkey patched my install with:And my Webpack css loader with:
and it works just dandy.
The fix should be as simple as allowing the explicit disabling of inlining css (perhaps
inlineCss: false
in webpacker.yml), then updating the Webpack::Instance#inlining_css? method and its partner inshakapacker/package/inliningCss.js
to respect the flag if it's set.The text was updated successfully, but these errors were encountered: