Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions tasks/browsersync.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ function browsersync(gulp, $, config, css, js) {
open: false
});

// set a config param to signal browserSync is active;
// styles.js will suppress errors for this env to avoid
// the watch process exiting on errors
config.livereload = true;

gulp.watch(config.styles.watch, { usePolling: true }, css);
gulp.watch(config.scripts.watch, { usePolling: true }, js);
}
Expand Down
9 changes: 8 additions & 1 deletion tasks/styles.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const PluginError = require('plugin-error');

function styles(gulp, $, config) {
// take the array and map over each script config object in it
const tasks = config.styles.files.map((stylesheet) => {
Expand All @@ -15,7 +17,12 @@ function styles(gulp, $, config) {
pipeStdout: true,
sassOutputStyle: 'nested',
includePaths: config.styles.includePaths ? config.styles.includePaths : [config.npmdir]
}).on('error', $.sass.logError))
}).on('error', function(error) {
const message = new PluginError('sass', error.messageFormatted).toString();
process.stderr.write(`${message}\n`);
config.livereload ? $.through2.obj() : process.exitCode = 1;
done();
}))
.pipe($.postcss(config.styles.postCssPlugins(config, stylesheet)))
.pipe($.concat(stylesheet.name))
.pipe($.cleanCss({
Expand Down