matthiasmullie / minify

CSS & JavaScript minifier, in PHP. Removes whitespace, strips comments, combines files (incl. @import statements and small assets in CSS files), and optimizes/shortens a few common programming patterns.
https://matthiasmullie.github.io/minify/
MIT License
1.97k stars 309 forks source link

Removing styles with value "none" #386

Closed helisoncruz closed 1 year ago

helisoncruz commented 2 years ago

I have the following style for tag a, after minify the result is like in the second code. text-decoration is gone, as is pseudo :active too.

a:hover, a:active {
    color: #26a151;
    text-decoration: none;
    -webkit-transition: all 0.2s ease;
    transition: all 0.2s ease;
}

Output:

a, a:focus {
    color: #2dbe60;
    -webkit-transition: all 0.2s ease;
    transition: all 0.2s ease;
}
simondud commented 2 years ago

@helisoncruz I tried to reproduce the issue and it doesn't happen with just the snippet you provided, in my test the output is:

a:hover,a:active{color:#26a151;text-decoration:none;-webkit-transition:all 0.2s ease;transition:all 0.2s ease}

Could you please provide a test case? The current unit tests are in tests/css/CSSTest.php, to use as example.

matthiasmullie commented 1 year ago

Input and output are very different: pseudo classes & color have also changed. Those are all transformations that the minifier doesn't do, so I would expect something else, unrelated, is amiss. I'm closing this ticket - feel free to reopen with more detail.