-
Notifications
You must be signed in to change notification settings - Fork 512
Multiple entry generates multiple CSS, How to merge css? #179
Comments
👍 this is confusing me as well! |
+1, have you been able to fix it? I want to merge my extracted css and sass files... |
+1, because webpack take last css chunk and just write him into final css file, dont merge. How merge all chunks? |
+1 Would be really helpful. I'm currently generating a |
+1 Trying to figure out how to do this also. |
Actually this is creating a single file for me now:
and...
|
This plugin seems very NOT maintained, yet it's very important. +1 for this thread. |
I just ran into this issue as well, and may have also figured out a way of working around it in the short term. The relevant snippet of my webpack config looks like this:
By having the last entry in the config include all modules that import CSS (foo.jsx, bar.js, and baz.jsx in this example), webpack-extract-text-plugin will include all of the CSS they need as this entry is the last entry that it processes. As long as this entry is last and is kept up-to-date (which is, of course, a pain point), the CSS chunks that webpack-extract-text-plugin generates should be concatenated together and bundled. Also, if anyone needs it, here is my loader (which includes SASS and PostCSS processing):
|
+1 Any suggestion on solving this? |
I think you might need a post-process plugin for this. If someone is interested, I've done something similar at purify plugin. You'll need to dig out the emitted CSS and concat as you want. |
@Findiglay Your solution helped me. Thanks |
@krazi3 You are right. This is more of a documentation issue. Tagged accordingly. |
@bebraw @Findiglay I try out your solution and and thanks for posting. But Still web pack creates multiple css bundles. |
@samithaf Can you open a separate issue with a link to to your project source in it? There is not enough info to debug. |
@bebraw please have a look on the sample project. https://github.com/samithaf/webpack-code-split Also I wonder it's required to create another issue for it since it's the same issue. |
If anyone is interested, I ended up creating a plugin for this purpose: |
@jtefera Nice work. Please publish to npm. Time to close this issue. |
Is already in npm!
|
@jtefera Ok, cool. Just got confused by the repo name (didn't match package name). Nice. 👍 |
Given that compression is most likely one of the last steps on the pipeline chain, it makes sense that the plugin uses the `emit` event which is the last step to add/modify assets before they're written to disk. This plays nicely with other plugins like https://github.com/jtefera/merge-files-webpack, that create and delete files on the fly AFTER they're compiled (this is the recommeded solution for this issue webpack-contrib/extract-text-webpack-plugin#179).
Given that compression is most likely one of the last steps on the pipeline chain, it makes sense that this plugin uses the `emit` event which is the last step to add/modify assets before they're written to disk. This plays nicely with other plugins that create and delete files on the fly AFTER they're compiled (for example https://github.com/jtefera/merge-files-webpack, which is the recommeded solution for this issue webpack-contrib/extract-text-webpack-plugin#179)
Multiple entry points can't result in a single bundle.css with a fixed filename, see webpack-contrib/extract-text-webpack-plugin#179 Until that's resolved, it's easier to keep the 'css' task separate in Webpack, and have a single entry point for all CSS (bundle.scss). Also partially reverting "Moved frontend assets into admin/ "module"", which moved too many files: debug.css and install.css need to remain as framework (not admin) deps. Split out into a separate `framework-css` Webpack task in preparation for splitting off the module.
Got it working. Install dev-dependecies
webpack.config.js
|
Given that compression is most likely one of the last steps on the pipeline chain, it makes sense that this plugin uses the `emit` event which is the last step to add/modify assets before they're written to disk. This plays nicely with other plugins that create and delete files on the fly AFTER they're compiled (for example https://github.com/jtefera/merge-files-webpack, which is the recommeded solution for this issue webpack-contrib/extract-text-webpack-plugin#179)
Given that compression is most likely one of the last steps on the pipeline chain, it makes sense that this plugin uses the `emit` event which is the last step to add/modify assets before they're written to disk. This plays nicely with other plugins that create and delete files on the fly AFTER they're compiled (for example https://github.com/jtefera/merge-files-webpack, which is the recommeded solution for this issue webpack-contrib/extract-text-webpack-plugin#179)
Given that compression is most likely one of the last steps on the pipeline chain, it makes sense that this plugin uses the `emit` event which is the last step to add/modify assets before they're written to disk. This plays nicely with other plugins that create and delete files on the fly AFTER they're compiled (for example https://github.com/jtefera/merge-files-webpack, which is the recommeded solution for this issue webpack-contrib/extract-text-webpack-plugin#179)
Webpack.config
post.js
post.css
about.js
about.css
I use ExtractTextPlugin, Now generates app.css
Looks only post.css,how can i merge about.css ,post.css to app.css
Like this app.css
webpack: 1.13.0
extract-text-webpack-plugin: 1.0.1
The text was updated successfully, but these errors were encountered: