From 80696c80d7ba4dce191b4ba811945ce6ce3317af Mon Sep 17 00:00:00 2001 From: Bobby Date: Fri, 27 May 2022 13:26:19 +0700 Subject: [PATCH] feat: use sass-embedded to compile if available this requires locally linking your globally-installed sass-embedded package, either through yarn link or whichever else we are not requiring it explicitly because supposedly the binaries are not widely available through all platforms e.g. yarn global add sass-embedded cd ~/.config/yarn/global/node_modules/sass-embedded yarn link cd /path/to/this/project yarn link sass-embedded actually symlinking via generic ln -s would do too, but the method above allows you to yarn link it into other projects, while maintaining the package itself via yarn global (to update, etc.) --- gulpfile.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gulpfile.js b/gulpfile.js index f23a0cf..af990d9 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -14,6 +14,11 @@ const sassCompiler = require('sass') const sourcemaps = require('gulp-sourcemaps') const stylelint = require('@ronilaukkarinen/gulp-stylelint') const terser = require('gulp-terser') +let sassEmbeddedCompiler +try { + sassEmbeddedCompiler = require('sass-embedded') + console.log('Using "sass-embedded" package to compile sass\u2026') +} catch (_) {} // Put built files for development on a Git-ignored directory. // This will prevent IDE's Git from unnecessarily @@ -26,7 +31,7 @@ const postcssPlugins = [ postcssPresetEnv() ] -sass.compiler = sassCompiler +sass.compiler = sassEmbeddedCompiler || sassCompiler // Minify on production if (process.env.NODE_ENV !== 'development') {