Skip to content
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

Keep example.css and generate example.min.css #29

Closed
philwareham opened this issue Dec 7, 2017 · 4 comments
Closed

Keep example.css and generate example.min.css #29

philwareham opened this issue Dec 7, 2017 · 4 comments

Comments

@philwareham
Copy link

@philwareham philwareham commented Dec 7, 2017

Hi there,

Can't seem to find an answer to this (and might be a good one to show an example of in the README) - but how could I use OptimizeCssAssetsPlugin to keep the original (unminified) CSS generated by ExtractTextPlugin as a file (i.e. example.css) and then generate a minified file copy (i.e. example.min.css too?

Thanks for any help!

@NMFR

This comment has been minimized.

Copy link
Owner

@NMFR NMFR commented Dec 9, 2017

Currently OptimizeCssAssetsPlugin transforms the original CSS asset and does not emit the original asset (basically it replaces the asset with the optimized version).

So it is not possible.
You can however run 2 parallel webpack builds, one with OptimizeCssAssetsPlugin and one without to get the 2 files.

Example webpack config:

module.exports = [
  {
    // webpack config without OptimizeCssAssetsPlugin to produce the original CSS file
  },
  {
    // webpack config with OptimizeCssAssetsPlugin to produce the optimized CSS file
  }
];

If you can expose your use case for this maybe we can check if it would be useful to add this feature to the plugin.

@philwareham

This comment has been minimized.

Copy link
Author

@philwareham philwareham commented Dec 11, 2017

Hi there, thanks for the reply. The reason I'd need two CSS files, one minified the other not, is that it is for a CSS library dist distribution where it is very useful for end users to have an unminified version of the CSS available for easier reference. Obviously for production they'd use the minified version.

@NMFR

This comment has been minimized.

Copy link
Owner

@NMFR NMFR commented Dec 11, 2017

I think this is a bit of an edge case. I am closing the issue. I am not saying this will not be implemented but since it can be generated with a parallel webpack config i don't think its worth it to implement it right now.

@NMFR NMFR closed this Dec 11, 2017
@philwareham

This comment has been minimized.

Copy link
Author

@philwareham philwareham commented Dec 12, 2017

OK, thanks. Not sure it's edge case - it's fairly common practice to provide both minified and unminified resources in a distribution - bit agree this can be achieved by other means.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.