Skip to content

Commit

Permalink
Display error message if source file does not exist.
Browse files Browse the repository at this point in the history
Uses `fs` to check that the source file exists before trying to compile SCSS to CSS.

See #41
  • Loading branch information
craigsimps committed Aug 21, 2017
1 parent 04b737b commit a2ec329
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tasks/build/css.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ var gulp = require('gulp'),
banner = require('postcss-banner'),
notify = require('gulp-notify'),
map = require('lodash.map'),
rename = require('gulp-rename');
rename = require('gulp-rename'),
fs = require('fs');


module.exports = function() {
Expand Down Expand Up @@ -86,12 +87,17 @@ module.exports = function() {
banner: themeHeader
}));
}

return postProcessors;

};

return map(config.css.scss, function(outputConfig, outputFilename) {

if (!fs.existsSync(outputConfig.src)) {
return console.log('ERROR >> Source file ' + outputConfig.src + ' was not found.');
}

return gulp
.src(outputConfig.src)
.pipe(bulksass())
Expand Down

0 comments on commit a2ec329

Please sign in to comment.