-
-
Notifications
You must be signed in to change notification settings - Fork 198
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 option to configure the CSS loader #335
Conversation
index.js
Outdated
disableUrlHandling() { | ||
webpackConfig.disableUrlHandling(); | ||
|
||
return this; |
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.
Hmm, I think a better idea would be to allow the css-loader
to be configured in general. So, to create a method more like configureBabel()
, where you pass it a callback, and we pass the callback the final config (which you can then modify). That'll allow you to disable the url handling... but also to modify any options on the css-loader
.
bfec30a
to
71021db
Compare
@weaverryan I've made some changes, can you check it out? |
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.
Hi @XWB,
I agree that'd be a useful addition to Encore (for instance it could help with #337 since it is not currently possible to easily disable/configure CSS minimization in production mode)
Could you also add some tests in test/loaders/css.js
to check that the callback is correctly applied?
@@ -581,6 +581,22 @@ class Encore { | |||
return this; | |||
} | |||
|
|||
/** | |||
* Configure the css-loader. | |||
* |
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.
Could you maybe add a link to https://github.com/webpack-contrib/css-loader#options there?
index.js
Outdated
* Configure the css-loader. | ||
* | ||
* Encore.configureCssLoader(function(config) { | ||
* // change the config |
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.
I'd also add a small example there so users know what to do with the config
object, for instance:
Encore.configureCssLoader(function(config) {
config.minimize = true;
});
2e3d919
to
64935f1
Compare
@Lyrkan @weaverryan All done. |
Thanks @XWB! |
@weaverryan Any idea when you will tag a new release that contains this feature? |
Disabling the URL handler can be handy for importing legacy CSS.
Fixes #334