Skip to content

processCss ignores props passed to cssnano via loader query #150

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

Closed
mdreizin opened this issue Sep 27, 2015 · 2 comments
Closed

processCss ignores props passed to cssnano via loader query #150

mdreizin opened this issue Sep 27, 2015 · 2 comments

Comments

@mdreizin
Copy link

css-loader?{"sourceMap":true,"minimize":true,"safe":true}

lib/processCss.js:157 should use Object.assign instead of Object.create.

var minimizeOptions = Object.create(query);

minimizeOptions will be:

{}
var minimizeOptions = Object.assign({}, query);

minimizeOptions will be:

{ "sourceMap": true, "minimize": true, "safe": true } 

cc @sokra

@jbmusso
Copy link

jbmusso commented Oct 7, 2015

Hi, thanks for spotting this. I'm currently facing the same issue when trying to circumvent the default webpack -p behavior. Indeed, webpack -p seems to be minifying the CSS in a destructive way by default because of cssnano default behavior (to the best of my understanding).
Related: a default behavior of the webpack -p flag could be that webpack unsures a non-destructive minification of css (default to cssnano safe mode, with aggressive/destructive mode being optional/explicit, maybe via a --optimize-aggressive flag). Maybe this could be better raised as a separate issue on the webpack repository.

A safe option was indeed added in css-nano (see cssnano/cssnano#59 merged and available in v3.2.0).

Versions:

  • webpack v1.12.2
  • css-loader v0.19.0 with cssnano v3.2.0

@salzhrani
Copy link

I confirm that @mdreizin pr fixes this issue

@sokra sokra closed this as completed in b8426f9 Oct 18, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants