The PHP port of the YUI CSS compressor runs itself against 3 test suites (their own, the original YUI one, and a microsoft one) to check for correctness:
https://github.com/tubalmartin/YUI-CSS-compressor-PHP-port
Running the same tests against Moodle's CSS compressor provides several suggestions for improvements e.g.:
1. remove the last semi-colon in a block of CSS statements
2. lowercase css keywords
3. don't leave any space between successive CSS rules or selectors
4. you can sometimes replace "none" with 0
Note that "failing" one of these tests isn't necessarily a bad thing. The YUI port skips many of the Microsoft tests because the expected test output for the microsoft tool is worse (i.e. larger) than what it produces. And it seems the goals of the Moodle compressor might exceed the YUI one in certain areas. But even so there seems to be a few tests that could either be run separately for ideas and/or ported into the current CSSlib test suite.
It might also be an idea to copy their test layout where it just iterates through a folder and compares files like e.g. test.css (the input) after processing with test.css.min (the expected output) to save repetitive test writing. A similar project, the PHP port of Less does the same but also uses PHPUnit like Moodle does:
https://github.com/leafo/lessphp/blob/master/tests/InputTest.php
- has a non-specific relationship to
-
MDL-38160 Implement PHP Port of a CSS Preprocessor
- Closed