Minification of CSS in -p mode removes -moz/-o/-ms rules
See original GitHub issueI was testing out Webpack with the -p
flag and got some weird results in my CSS compared to my regular page. One of these errors was the aparent removal of CSS code.
CSS in my .css-file:
.systembar::before {
background: #0066b3;
background: -o-linear-gradient(left, #a2c517 10%, #009046 30%, #0082b6 50%, #151f77 75%, #db0050 100%);
background: -moz-linear-gradient(left, #a2c517 10%, #009046 30%, #0082b6 50%, #151f77 75%, #db0050 100%);
background: -webkit-linear-gradient(left, #a2c517 10%, #009046 30%, #0082b6 50%, #151f77 75%, #db0050 100%);
background: -ms-linear-gradient(left, #a2c517 10%, #009046 30%, #0082b6 50%, #151f77 75%, #db0050 100%);
background: -webkit-gradient(linear, left top, right top, color-stop(0.1, #a2c517), color-stop(0.3, #009046), color-stop(0.5, #0082b6), color-stop(0.75, #151f77), color-stop(1, #db0050));
background: linear-gradient(left, #a2c517 10%, #009046 30%, #0082b6 50%, #151f77 75%, #db0050 100%);
}
After inspecting the ::before object in Firefox:
{
background: #0066b3;
background: -webkit-linear-gradient(left,#a2c517 10%,#009046 30%,#0082b6 50%,#151f77 75%,#db0050);
background: -webkit-gradient(linear,left top,right top,color-stop(.1,#a2c517),color-stop(.3,#009046),color-stop(.5,#0082b6),color-stop(.75,#151f77),color-stop(1,#db0050));
background: linear-gradient(left,#a2c517 10%,#009046 30%,#0082b6 50%,#151f77 75%,#db0050);
}
This is of course not matched to Firefox, and the background becomes blue instead of gradient
It seems that the minification done by -p
removed the Firefox/Opera/IE-specific lines, and kept only the Wekbit parts.
Why is this done, and how can I prevent this bug?
Issue Analytics
- State:
- Created 8 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Minification of CSS in -p mode removes -moz/-o/-ms rules #248
Copied from webpack issue#2158 I was testing out Webpack with the -p flag and got some weird results in my CSS compared to...
Read more >The complete best practices for minifying CSS - LogRocket Blog
Minifying CSS files is more nuanced than you might think at first. Learn the various minification tools, how to determine and remove unused ......
Read more >Minify CSS – CSS Minifying and Compression Explained
The goal of minification is to remove the parts of your CSS code that are irrelevant to the browser to interpret the CSS....
Read more >What is Minification | Why minify JS, HTML, CSS files - Imperva
Minification is the process of minimizing code and markup in your web pages and script files. It's one of the main methods used...
Read more >Bundling and Minification | Microsoft Learn
Minification performs a variety of different code optimizations to scripts or css, such as removing unnecessary white space and comments and ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
adding
-autoprefixer
as an option to css-loader fixes this in our case. We use autoprefixer ourselves to manually add support for stuff for quite old IEs and Chromes, which cssnano removedMoved issue here though it was already answered by @SimenB in this issue. Closing.