Last active
May 17, 2016 09:36
-
-
Save martinjinda/fd0e77a8b6e9a1bfb518074694c91ff5 to your computer and use it in GitHub Desktop.
Setting for compiling SCSS files + automatic refresh in browser (watching index.html + all scss files)
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
var gulp = require('gulp'); | |
var browserSync = require('browser-sync'); | |
var sass = require('gulp-sass'); | |
var cleanCSS = require('gulp-clean-css'); | |
gulp.task('sass', function(){ | |
return gulp.src('dist/scss/main.scss') | |
.pipe(sass()) | |
.pipe(cleanCSS({compatibility: 'ie8'})) | |
.pipe(gulp.dest('src/css')) | |
.pipe(browserSync.reload({ | |
stream: true | |
})) | |
}); | |
gulp.task('browser-sync', function () { | |
browserSync.init(['src/css/*.css'], { | |
server: { | |
baseDir: 'src' | |
} | |
}); | |
}); | |
gulp.task('watch', ['sass', 'browser-sync'], function () { | |
gulp.watch(['dist/scss/**/*.scss'], ['sass']); | |
gulp.watch('src/*.html', browserSync.reload); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment