From d3fd0d5ab7a55d87ce8ac97d08ec49717b2eccbe Mon Sep 17 00:00:00 2001 From: Robert Lange <robert.lange@uni-leipzig.de> Date: Mon, 7 Sep 2020 17:33:11 +0200 Subject: [PATCH] refs #18286 [master] include print.scss in docker grunt task for scss to css compilation * ignore print.css and compiled.css globally in finc gitignore and delete obsolete one in finc css folder --- .gitignore | 2 ++ Gruntfile.js | 21 ++++++++++++++++++--- themes/finc/css/.gitignore | 1 - 3 files changed, 20 insertions(+), 4 deletions(-) delete mode 100644 themes/finc/css/.gitignore diff --git a/.gitignore b/.gitignore index d5d2a71d033..156e4b34ca9 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,5 @@ import/solrmarc.log* /docker-compose.override.yml /docker-env.override.yml /.env +**/compiled.css +**/print.css \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js index 4e6e7c38cc4..7b8ac2951f9 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -3,6 +3,10 @@ module.exports = function(grunt) { var fs = require('fs'); + /** + * @param {string} file + * @return {Array} retval - path to file as Array + */ function getLoadPaths(file) { var config; var parts = file.split('/'); @@ -201,9 +205,13 @@ module.exports = function(grunt) { var sassConfig = {}, path = require('path'), themeList = fs.readdirSync(path.resolve('themes')).filter(function (theme) { - return fs.existsSync(path.resolve('themes/' + theme + '/scss/compiled.scss')); + return fs.existsSync(path.resolve('themes/' + theme + '/scss/compiled.scss')) + || fs.existsSync(path.resolve('themes/' + theme + '/scss/print.scss')); }); + /** + * Define mapping of input (scss) to output files (css) for following sass task + */ for (var i in themeList) { var config = { options: { @@ -212,7 +220,7 @@ module.exports = function(grunt) { files: [{ expand: true, cwd: path.join('themes', themeList[i], 'scss'), - src: ['compiled.scss'], + src: ['compiled.scss', 'print.scss'], dest: path.join('themes', themeList[i], 'css'), ext: '.css' }] @@ -220,7 +228,14 @@ module.exports = function(grunt) { for (var key in this.data.options) { config.options[key] = this.data.options[key] + ''; } - config.options.includePaths = getLoadPaths('themes/' + themeList[i] + '/scss/compiled.scss'); + + /* get Array of unique input paths */ + config.options.includePaths = Array.from( + new Set( + getLoadPaths('themes/' + themeList[i] + '/scss/compiled.scss') + .concat(getLoadPaths('themes/' + themeList[i] + '/scss/print.scss')) + ) + ); sassConfig[themeList[i]] = config; } diff --git a/themes/finc/css/.gitignore b/themes/finc/css/.gitignore deleted file mode 100644 index ecd34d2f94d..00000000000 --- a/themes/finc/css/.gitignore +++ /dev/null @@ -1 +0,0 @@ -compiled.css \ No newline at end of file -- GitLab