Closed
Description
In the course of a meeting with Google I've got the recommendation to split the CSS by media queries into separate files.
I'm trying to find a webpack solution to this for some days but without any success so far.
I've found postcss plugins such as css-mqpacker or webpack plugins such as css-magic-split-webpack-plugin. But none of them seem to be a real solution.
The goal is that webpack transforms the following code
example.css
.foo { color: blue; }
@media screen and (max-width: 40em) {
.foo { color: red; }
}
.bar { font-size: 1rem; }
@media screen and (max-width: 40em) {
.bar { font-size: 2rem; }
}
.test { z-index: 1; }
into
example.css
.foo { color: blue; }
.bar { font-size: 1rem; }
.test { z-index: 1; }
example-tablet.css (or any other name)
@media screen and (max-width: 40em) {
.foo { color: red; }
.bar { font-size: 2rem; }
}
@evilebottnawi is this something that belong to the mini-css-extract-plugin or would you rather see it as a new plugin?