Whole file
sprymix/csscompressor
The author described this change as “Fix @supports directives minification (#12)”. It counts as a record because the check below fails on the code as it stood at 0857438db and passes on 49d54c4f4, with nothing else changed between the two runs.
Projectsprymix/csscompressor
Fix saved2022-07-23
Sharing licenceBSD-3-Clause · LICENSE
Change size+4 −0
What the code was meant to do, written into the code itself as a save note
Fix @supports directives minification (#12)
The change
| 51 | 51 | re.I | re.X) | |
| 52 | 52 | ||
| 53 | 53 | _space_and_re = re.compile(r'\band\(', re.I) | |
| 54 | + | _supports_parenthesis_re = re.compile(r'(@supports)([^{]*)', re.I) | |
| 54 | 55 | ||
| 55 | 56 | _space_after_re = re.compile(r'([!{}:;>+\(\[,])\s+') | |
| 56 | 57 | ||
| ⋯ | |||
| 389 | 390 | # Put the space back in some cases, to support stuff like | |
| 390 | 391 | # @media screen and (-webkit-min-device-pixel-ratio:0){ | |
| 391 | 392 | css = _space_and_re.sub('and (', css) | |
| 393 | + | ||
| 394 | + | # Put the parenthesis back on @supports directive | |
| 395 | + | css = _supports_parenthesis_re.sub(lambda match: match.group(1) + '(' + match.group(2) + ')', css) | |
| 392 | 396 | ||
| 393 | 397 | # Remove the spaces after the things that should not have spaces after them. | |
| 394 | 398 | css = _space_after_re.sub(r'\1', css) | |
The check that tells the two apart
fail→pass·csscompressor/tests/test_other.py::Tests::test_supports_directive
Check file csscompressor/tests/test_other.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before it0857438db725d5c1d2672f45d9cf3e7dc14646a4
Broken version dated2017-11-26
Modulecsscompressor.__init__
Units changed_compress
Fingerprint5b006b028e0f318f
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.
Other bugs found in sprymix/csscompressor
- 2014-04-04compress_partitioned