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

Themes should be given the option to not be optimised by the CSS optimiser is enabled.

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.3
    • Component/s: Themes
    • Labels:
    • Testing Instructions:
      Hide

      Developer or designer required for testing. You must have Firebug or similar available.

      1. Log in as an administrator
      2. Turn on theme designer mode
      3. Enable the CSS optimiser
      4. Enable URL theme change
      5. Browse to a course front page using anything but the mymobile theme.
      6. Use Firebug or similar to get the URL for any core CSS file and open it in a new tab.
      7. Check that it has been optimised (likely on minimal lines)
      8. Change your theme to the Mymobile theme on URL &theme=mymobile)
      9. Use Firebug again to get the same URL (it will have changed now I in most cases) and open it in a new tab
      10. Check that it is not optimised (several+ lines)
      Show
      Developer or designer required for testing. You must have Firebug or similar available. Log in as an administrator Turn on theme designer mode Enable the CSS optimiser Enable URL theme change Browse to a course front page using anything but the mymobile theme. Use Firebug or similar to get the URL for any core CSS file and open it in a new tab. Check that it has been optimised (likely on minimal lines) Change your theme to the Mymobile theme on URL &theme=mymobile) Use Firebug again to get the same URL (it will have changed now I in most cases) and open it in a new tab Check that it is not optimised (several+ lines)
    • Affected Branches:
      MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE
    • Pull Master Branch:
      wip-MDL-33596-m23

      Description

      While working on MDL-33468 I came to the realisation that theme's should be given the option to support the CSS optimiser or not.

      The reason I came to this conclusion is because the CSS in that theme for JQuery has already been optimised, and because its optimised to minimise selector complexity is not compatible with the CSS optimiser I wrote.

      The CSS optimiser I wrote takes rules and compacts them based upon common styles.
      For example:

      .one {display:none;}
      .two {display:none;}
      /** would be optimised to **/
      .one,
      .two {display:none;}

      However as illustrated by a problem in the mymobile theme the following CSS optimisation breaks things:

      .one {display:none;}
      .panel {display:block;}
      .panel-hidden {display:none}
      /** Which gets optimised to **/
      .one,
      .panel-hidden {display:none}
      .panel {display:block;}

      That change in order may seem trivial, however that change in order was how the panels visibly was being controlled, through the most basic level of inheritance.

      This sort of thing affects affects all CSS not just theme CSS. However in every case I looked at within Moodle core this wasn't a problem. Our internal CSS is not nearly that well grounded and in effect allows the CSS optimiser to work. However YUI CSS (which we were already purposefully not trying to optimise) and JQuery CSS are the exception.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  25/Jun/12