gulp.task('css-browsersync', function() { | |
return gulp.src(["*.scss"]) | |
.pipe(sass().on('error', function(err) { | |
console.error(err.message); | |
browserSync.notify(err.message, 3000); // Display error in the browser | |
this.emit('end'); // Prevent gulp from catching the error and exiting the watch process | |
})) | |
.pipe(gulp.dest("public/")) | |
.pipe(browserSync.stream()); | |
}); | |
gulp.task('watch', ['css-browsersync'], function() { | |
browserSync.init({ | |
server: "./public" | |
}); | |
gulp.watch("*.scss", ['css-browsersync']); | |
gulp.watch("public/*.html").on('change', browserSync.reload); | |
// protip: stop old version of gulp watch from running when you modify the gulpfile | |
gulp.watch("gulpfile.js").on("change", () => process.exit(0)); | |
}); |
This comment has been minimized.
This comment has been minimized.
Thanks - this with the message to the browserSync is really handy. |
This comment has been minimized.
This comment has been minimized.
Thanks bro |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
Thanks Bro!