Skip to content
This repository has been archived by the owner on Dec 4, 2021. It is now read-only.

Commit

Permalink
Added suggested detection of compiler from dlmanning#748
Browse files Browse the repository at this point in the history
  • Loading branch information
GregOriol committed Feb 1, 2021
1 parent 534e343 commit 18c8985
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,21 @@ const gulpSass = (options, sync) => through.obj((file, enc, cb) => { // eslint-d
};

// eslint-disable-next-line global-require, import/no-extraneous-dependencies
const compiler = gulpSass.compiler || require('node-sass');
let compiler = gulpSass.compiler;
if (!compiler) {
try {
compiler = require('node-sass');
} catch (e) {
try {
compiler = require('sass');
} catch (e) {
return cb(new PluginError(
PLUGIN_NAME,
"No compiler found!\nPlease install one of the npm packages: node-sass or sass, or set compiler in code:\n const sass = require('gulp-sass');\n sass.compiler = require('sass');\n"
));
}
}
}

if (sync !== true) {
//////////////////////////////
Expand Down

0 comments on commit 18c8985

Please sign in to comment.