From 34cc53861b4cf3c510a73d31390b45cc267c866f Mon Sep 17 00:00:00 2001 From: Mark Friedrich Date: Sat, 7 Apr 2018 13:42:38 +0200 Subject: [PATCH] - minor GulpFile improvements for CSS build, #609 --- gulpfile.js | 66 +++++++++++++++++++++++++---------------------------- 1 file changed, 31 insertions(+), 35 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index d69ed1af..f601b1fc 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -99,36 +99,6 @@ let uglifyJsOptions = { // Sourcemaps options // https://www.npmjs.com/package/gulp-sourcemaps -// -- Plugin options ---------------------------------------------------------- - -let gZipOptions = { - append: false, // disables default append ext .gz - extension: 'gz', // use "custom" ext: .gz - threshold: '1kb', // min size required to compress a file - deleteMode: PATH.JS.DIST_BUILD, // replace *.gz files if size < 'threhold' - gzipOptions: { - level: 9 // zlib.Gzip compression level [0-9] - }, - skipGrowingFiles: true // use orig. files in case of *.gz size > orig. size -}; - -let brotliOptions = { - extension: 'br', // use "custom" ext: .br - mode: 1, // compression mode for UTF-8 formatted text - quality: 11, // quality [1 worst - 11 best] - skipLarger: true // use orig. files in case of *.br size > orig. size -}; - -let compassOptions = { - config_file: './config.rb', - css: 'public/css/#VERSION#', // #VERSION# will be replaced with version tag - sass: 'sass', - time: true, // show execution time - sourcemap: true -}; - -let compressionExt = [gZipOptions.extension, brotliOptions.extension]; - // -- Error output ------------------------------------------------------------ /** @@ -155,9 +125,8 @@ let printError = (title, example) => { let tagVersion; try{ let pathfinderAppIni = ini.parse(fs.readFileSync(pathfinderConfigFileApp, 'utf-8')); - let pathfinderConfIni = fs.existsSync(pathfinderConfigFileConf) - ? ini.parse(fs.readFileSync(pathfinderConfigFileConf, 'utf-8')) - : {}; + let pathfinderConfIni = fs.existsSync(pathfinderConfigFileConf) ? + ini.parse(fs.readFileSync(pathfinderConfigFileConf, 'utf-8')) : {}; let pathfinderIni = merge(pathfinderAppIni, pathfinderConfIni); try{ @@ -196,8 +165,35 @@ let CONF = { DEBUG: false }; -// place version tag into compass options -compassOptions.css = compassOptions.css.replace('#VERSION#', CONF.TAG); +// -- Plugin options ---------------------------------------------------------- + +let gZipOptions = { + append: false, // disables default append ext .gz + extension: 'gz', // use "custom" ext: .gz + threshold: '1kb', // min size required to compress a file + deleteMode: PATH.JS.DIST_BUILD, // replace *.gz files if size < 'threshold' + gzipOptions: { + level: 9 // zlib.Gzip compression level [0-9] + }, + skipGrowingFiles: true // use orig. files in case of *.gz size > orig. size +}; + +let brotliOptions = { + extension: 'br', // use "custom" ext: .br + mode: 1, // compression mode for UTF-8 formatted text + quality: 11, // quality [1 worst - 11 best] + skipLarger: true // use orig. files in case of *.br size > orig. size +}; + +let compassOptions = { + config_file: './config.rb', + css: 'public/css/' + CONF.TAG, // #VERSION# will be replaced with version tag + sass: 'sass', + time: true, // show execution time + sourcemap: true +}; + +let compressionExt = [gZipOptions.extension, brotliOptions.extension]; // == Helper methods ==================================================================================================