From 7055fcd247d38f363e087f8e983078b069b000bc Mon Sep 17 00:00:00 2001 From: Bryce Gilhome Date: Thu, 4 Jul 2019 12:32:44 -0700 Subject: [PATCH] Use the sassOptions present in gulp config (or a project's local gulp config). Enforce the cssConfig values for outputStyle, sourceComments and includePaths. --- gulp-tasks/gulp-css.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gulp-tasks/gulp-css.js b/gulp-tasks/gulp-css.js index 61d2b0b..d5bb7bb 100644 --- a/gulp-tasks/gulp-css.js +++ b/gulp-tasks/gulp-css.js @@ -8,9 +8,10 @@ const cached = require('gulp-cached'); const flatten = require('gulp-flatten'); const gulpif = require('gulp-if'); const cleanCSS = require('gulp-clean-css'); +const _ = require('lodash'); ((() => { - module.exports = (gulp, { cssConfig, debug }, { watch, validate }, browserSync) => { + module.exports = (gulp, { cssConfig, debug, sassOptions }, { watch, validate }, browserSync) => { function cssCompile(done) { gulp.src(cssConfig.src) .pipe(sassGlob()) @@ -21,12 +22,12 @@ const cleanCSS = require('gulp-clean-css'); }], })) .pipe(sourcemaps.init({ debug })) - .pipe(sass({ + .pipe(sass(_.defaultsDeep({ outputStyle: cssConfig.outputStyle, sourceComments: cssConfig.sourceComments, // eslint-disable-next-line global-require includePaths: require('node-normalize-scss').with(cssConfig.includePaths), - }).on('error', sass.logError)) + }, sassOptions || {})).on('error', sass.logError)) .pipe(prefix(cssConfig.autoPrefixerBrowsers)) .pipe(sourcemaps.init()) .pipe(gulpif(cssConfig.cleanCSS.enabled === true, cleanCSS({