diff --git a/lib/outputlib.php b/lib/outputlib.php index 416b9445721..d65775bd94b 100644 --- a/lib/outputlib.php +++ b/lib/outputlib.php @@ -315,6 +315,12 @@ class theme_config { */ public $hidefromselector = false; + /** + * @var array list of YUI CSS modules to be included on each page. This may be used + * to remove cssreset and use cssnormalise module instead. + */ + public $yuicssmodules = array('cssreset', 'cssfonts', 'cssgrids', 'cssbase'); + /** * @var renderer_factory Instance of the renderer_factory implementation * we are using. Implementation detail. @@ -407,7 +413,8 @@ class theme_config { $configurable = array('parents', 'sheets', 'parents_exclude_sheets', 'plugins_exclude_sheets', 'javascripts', 'javascripts_footer', 'parents_exclude_javascripts', 'layouts', 'enable_dock', 'enablecourseajax', 'supportscssoptimisation', - 'rendererfactory', 'csspostprocess', 'editor_sheets', 'rarrow', 'larrow', 'hidefromselector', 'doctype'); + 'rendererfactory', 'csspostprocess', 'editor_sheets', 'rarrow', 'larrow', 'hidefromselector', 'doctype', + 'yuicssmodules'); foreach ($config as $key=>$value) { if (in_array($key, $configurable)) { diff --git a/lib/outputrequirementslib.php b/lib/outputrequirementslib.php index 7aa0c608660..f5a676adfb7 100644 --- a/lib/outputrequirementslib.php +++ b/lib/outputrequirementslib.php @@ -963,27 +963,31 @@ class page_requirements_manager { * Major benefit of this compared to standard js/csss loader is much improved * caching, better browser cache utilisation, much fewer http requests. * + * @param moodle_page $page * @return string */ - protected function get_yui3lib_headcode() { + protected function get_yui3lib_headcode($page) { global $CFG; $code = ''; if ($this->yui3loader->combine) { - $code .= ''; + if (!empty($page->theme->yuicssmodules)) { + $modules = array(); + foreach ($page->theme->yuicssmodules as $module) { + $modules[] = "$CFG->yui3version/build/$module/$module-min.css"; + } + $code .= ''; + } $code .= ''; } else { - $code .= ''; - $code .= ''; - $code .= ''; - $code .= ''; + if (!empty($page->theme->yuicssmodules)) { + foreach ($page->theme->yuicssmodules as $module) { + $code .= ''; + } + } $code .= ''; $code .= ''; } @@ -1060,7 +1064,7 @@ class page_requirements_manager { $this->init_requirements_data($page, $renderer); // YUI3 JS and CSS is always loaded first - it is cached in browser. - $output = $this->get_yui3lib_headcode(); + $output = $this->get_yui3lib_headcode($page); // Now theme CSS + custom CSS in this specific order. $output .= $this->get_css_code(); diff --git a/theme/upgrade.txt b/theme/upgrade.txt index cd0098f7587..441d0b05d3a 100644 --- a/theme/upgrade.txt +++ b/theme/upgrade.txt @@ -5,6 +5,8 @@ information provided here is intended especially for theme designer. DOM changes: * changed the h1 title in the help popup to a h2. +* new setting $THEME->yuicssmodules = array('cssreset', 'cssfonts', 'cssgrids', 'cssbase'); which + allows themes to use different CSS reset normalisers such as cssnormalize YUI module === 2.4 ===