Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Output Gulp compilation errors to the browser via Browser-Sync:
- var gulp = require("gulp");
- var sass = require("gulp-sass");
- var autoprefix = require("gulp-autoprefixer");
- var filter = require('gulp-filter');
- var browserSync = require('browser-sync');
- var reload = browserSync.reload;
- /**
- * Start BrowserSync
- */
- gulp.task('browser-sync', function () {
- browserSync({
- server: "./dist"
- });
- });
- /**
- * Compile sass
- */
- gulp.task('sass', function () {
- return gulp.src('lib/scss/**/*.scss')
- .pipe(sass())
- .on('error', function(err){
- browserSync.notify(err.message, 3000);
- this.emit('end');
- })
- .pipe(autoprefix())
- .pipe(gulp.dest('lib/css'))
- .pipe(filter("**/*.css"))
- .pipe(reload({stream:true}));
- });
- /**
- * Watch
- */
- gulp.task('default', ['sass', 'browser-sync'], function () {
- gulp.watch('lib/scss/**/*.scss', ['sass']);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement