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.)
This commit is contained in:
Bobby 2022-05-27 13:26:19 +07:00
parent 832ce2df5c
commit 80696c80d7
No known key found for this signature in database
GPG Key ID: 941839794CBF5A09
1 changed files with 6 additions and 1 deletions

View File

@ -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') {