Last active
August 25, 2023 02:55
-
-
Save kornelski/ca9631f5348383b61bc7b359e96ced38 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); | |
}); |
Thanks - this with the message to the browserSync is really handy.
Thanks bro
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks Bro!