Closed alexwlchan closed 7 years ago
Yeah, we need to fix this. I've seen it too. When I originally wrote mincss I didn't care and I hacked a solution. It's time to fix it. I think the implementation is kinda sucky and uses some really basic string replacements. I bet you can fix it. It shouldn't be hard to write a unit test that proves it's broken (using your example above) and then you can hack and hack until the unit test passes.
Do you know how to run the unit tests?
I think the implementation is kinda sucky and uses some really basic string replacements. I bet you can fix it. It shouldn't be hard to write a unit test that proves it's broken (using your example above) and then you can hack and hack until the unit test passes.
Sounds good. I don’t have time right now, but I’ve stuck a note in my task list to come back to this if I get time.
Do you know how to run the unit tests?
Looking in .travis.yml
suggests that nosetests
is enough?
Looking in .travis.yml suggests that nosetests is enough?
Yes. There might be some notes about it in the readme too.
I have the following HTML file with the same
@media
query appearing twice:If I run the following script:
I get an AssertionError:
The expected behaviour in this case would be:
<p>
tag, the CSS is reduced to one instance of the @media query<p>
tag, both instances of the @media query are removedI hit this from a weird corner case in my build system where it sometimes renders duplicate CSS selectors, and then I pass it into
mincss
for extra processing. I have a fairly easy workaround – this could be considered a case of “garbage in, garbage out” – but having tracked it down, I thought I might as well report it.Version info: