Merge branch 'MDL-59261-35' of git://github.com/ryanwyllie/moodle into MOODLE_35_STABLE

This commit is contained in:
Jake Dallimore
2018-07-03 14:44:53 +08:00
8 changed files with 17932 additions and 39 deletions
+1
View File
@@ -2,6 +2,7 @@
theme/bootstrapbase/style/
theme/clean/style/custom.css
theme/more/style/custom.css
theme/boost/style/moodle.css
node_modules/
vendor/
admin/tool/policy/amd/src/jquery-eu-cookie-law-popup.js
+14 -2
View File
@@ -137,6 +137,16 @@ module.exports = function(grunt) {
}
}
},
sass: {
dist: {
files: {
"theme/boost/style/moodle.css": "theme/boost/scss/preset/default.scss"
}
},
options: {
includePaths: ["theme/boost/scss/"]
}
},
watch: {
options: {
nospawn: true // We need not to spawn so config can be changed dynamically.
@@ -214,7 +224,8 @@ module.exports = function(grunt) {
'# Generated by "grunt ignorefiles"',
'theme/bootstrapbase/style/',
'theme/clean/style/custom.css',
'theme/more/style/custom.css'
'theme/more/style/custom.css',
'theme/boost/style/moodle.css'
].concat(thirdPartyPaths);
grunt.file.write('.stylelintignore', stylelintIgnores.join('\n'));
};
@@ -362,6 +373,7 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-eslint');
grunt.loadNpmTasks('grunt-stylelint');
@@ -374,7 +386,7 @@ module.exports = function(grunt) {
grunt.registerTask('js', ['amd', 'yui']);
// Register CSS taks.
grunt.registerTask('css', ['stylelint:scss', 'stylelint:less', 'less:bootstrapbase', 'stylelint:css']);
grunt.registerTask('css', ['stylelint:scss', 'sass', 'stylelint:less', 'less:bootstrapbase', 'stylelint:css']);
// Register the startup task.
grunt.registerTask('startup', 'Run the correct tasks for the current directory', tasks.startup);
+35 -2
View File
@@ -669,6 +669,12 @@ class theme_config {
*/
public $remapiconcache = [];
/**
* The name of the function to call to get precompiled CSS.
* @var string
*/
public $precompiledcsscallback = null;
/**
* Load the config.php file for a particular theme, and return an instance
* of this class. (That is, this is a factory method.)
@@ -746,7 +752,8 @@ class theme_config {
'rendererfactory', 'csspostprocess', 'editor_sheets', 'rarrow', 'larrow', 'uarrow', 'darrow',
'hidefromselector', 'doctype', 'yuicssmodules', 'blockrtlmanipulations',
'lessfile', 'extralesscallback', 'lessvariablescallback', 'blockrendermethod',
'scss', 'extrascsscallback', 'prescsscallback', 'csstreepostprocessor', 'addblockposition', 'iconsystem');
'scss', 'extrascsscallback', 'prescsscallback', 'csstreepostprocessor', 'addblockposition',
'iconsystem', 'precompiledcsscallback');
foreach ($config as $key=>$value) {
if (in_array($key, $configurable)) {
@@ -1097,7 +1104,13 @@ class theme_config {
} else {
if ($type === 'theme' && $identifier === self::SCSS_KEY) {
// We need the content from SCSS because this is the SCSS file from the theme.
$csscontent .= $this->get_css_content_from_scss(false);
if ($compiled = $this->get_css_content_from_scss(false)) {
$csscontent .= $compiled;
} else {
// The compiler failed so default back to any precompiled css that might
// exist.
$csscontent .= $this->get_precompiled_css_content();
}
} else if ($type === 'theme' && $identifier === $this->lessfile) {
// We need the content from LESS because this is the LESS file from the theme.
$csscontent .= $this->get_css_content_from_less(false);
@@ -1494,6 +1507,26 @@ class theme_config {
return $compiled;
}
/**
* Return the precompiled CSS if the precompiledcsscallback exists.
*
* @return string Return compiled css.
*/
public function get_precompiled_css_content() {
$configs = [$this] + $this->parent_configs;
$css = '';
foreach ($configs as $config) {
if (isset($config->precompiledcsscallback)) {
$function = $config->precompiledcsscallback;
if (function_exists($function)) {
$css .= $function($this);
}
}
}
return $css;
}
/**
* Get the icon system to use.
*
+901 -35
View File
File diff suppressed because it is too large Load Diff
+1
View File
@@ -12,6 +12,7 @@
"grunt-contrib-uglify": "1.0.1",
"grunt-contrib-watch": "1.0.0",
"grunt-eslint": "20.1.0",
"grunt-sass": "2.1.0",
"grunt-stylelint": "0.6.0",
"semver": "5.3.0",
"shifter": "0.5.0",
+1
View File
@@ -150,6 +150,7 @@ $THEME->enable_dock = false;
$THEME->csstreepostprocessor = 'theme_boost_css_tree_post_processor';
$THEME->extrascsscallback = 'theme_boost_get_extra_scss';
$THEME->prescsscallback = 'theme_boost_get_pre_scss';
$THEME->precompiledcsscallback = 'theme_boost_get_precompiled_css';
$THEME->yuicssmodules = array();
$THEME->rendererfactory = 'theme_overridden_renderer_factory';
$THEME->requiredblocks = '';
+10
View File
@@ -109,6 +109,16 @@ function theme_boost_get_main_scss_content($theme) {
return $scss;
}
/**
* Get compiled css.
*
* @return string compiled css
*/
function theme_boost_get_precompiled_css() {
global $CFG;
return file_get_contents($CFG->dirroot . '/theme/boost/style/moodle.css');
}
/**
* Get SCSS to prepend.
*
File diff suppressed because it is too large Load Diff