From f2bdae32c6d2769d86e56f60a4211ad2ae304462 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Birkemeyer?= Date: Tue, 12 Apr 2022 17:49:10 +0000 Subject: [PATCH 1/3] Address the config property name change to 'loadPaths' when using Dart Sass --- tasks/styles.js | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/tasks/styles.js b/tasks/styles.js index a8562f5..fa0a8a7 100644 --- a/tasks/styles.js +++ b/tasks/styles.js @@ -8,14 +8,22 @@ function styles(gulp, $, config) { return; } + const sassIncludePaths = config.styles.includePaths ? config.styles.includePaths : [config.npmdir]; + let sassConfig = { + cwd: config.webdir, + pipeStdout: true, + sassOutputStyle: 'nested', + }; + + if (!config.styles.sassCompiler || config.styles.sassCompiler !== "node-sass") { + sassConfig.loadPaths = sassIncludePaths; + } else { + sassConfig.includePaths = sassIncludePaths; + } + return gulp.src(sourceFiles, { cwd: config.webdir }) .pipe(config.development ? $.sourcemaps.init() : $.through2.obj()) - .pipe($.sass({ - cwd: config.webdir, - pipeStdout: true, - sassOutputStyle: 'nested', - includePaths: config.styles.includePaths ? config.styles.includePaths : [config.npmdir] - }).on('error', $.sass.logError)) + .pipe($.sass(sassConfig).on('error', $.sass.logError)) .pipe($.postcss(config.styles.postCssPlugins(config, stylesheet))) .pipe($.concat(stylesheet.name)) .pipe($.cleanCss({ From 0ae394b2b554479f2b52f3da7edf6aaf515bd2ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Birkemeyer?= Date: Tue, 12 Apr 2022 17:50:17 +0000 Subject: [PATCH 2/3] Update README with pointers to use pacakge 'sass-embedded' instead of 'sass' for better compile performance --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8a464d2..87e9139 100644 --- a/README.md +++ b/README.md @@ -109,7 +109,7 @@ module.exports = { #### Choose the Sass compiler -For backwards-compatibility reasons, the default compiler is LibSass via node-sass, [which has been deprecated by the Sass project](https://sass-lang.com/blog/libsass-is-deprecated). You can pick the canonical implementation (Dart Sass) by setting `sassCompiler` on the `styles` object in `gulp-config.js`. You will need to install the Dart Sass Node package via npm or yarn (`npm install sass` or `yarn add sass`). +For backwards-compatibility reasons, the default compiler is LibSass via node-sass, [which has been deprecated by the Sass project](https://sass-lang.com/blog/libsass-is-deprecated). You can pick the canonical implementation (Dart Sass) by setting `sassCompiler` on the `styles` object in `gulp-config.js`. You will need to install the Dart Sass Node package via npm or yarn (`npm install sass-embedded` or `yarn add sass-embedded`). Example (excerpt from `gulp-config.js`): @@ -119,7 +119,7 @@ styles: { files: [ … ], - sassCompiler: 'sass', // this passes Dart Sass to gulp-sass + sassCompiler: 'sass-embedded', // this is an official version of Dart Sass, optimized for embedded use in NodeJS (faster compile times) postCssPlugins: postCssPlugins, watch: ['src/**/*.scss'] }, From a96e233440b9304f0ae21ed4dd19e23f9540d4e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Birkemeyer?= Date: Tue, 12 Apr 2022 17:50:27 +0000 Subject: [PATCH 3/3] Bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 31d7355..0f4e51e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "webfactory-gulp-preset", - "version": "2.5.1", + "version": "2.5.2", "dependencies": { "@babel/core": "^7.13.8", "@babel/preset-env": "^7.13.8",