Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-37698

Run the experimental CSS compressor against other compressors test suites

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Not a bug
    • Icon: Minor Minor
    • None
    • 2.4.1
    • Libraries
    • MOODLE_24_STABLE

      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

            moodle.com Moodle HQ
            bawjaws David Scotson
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.