Last active
February 12, 2016 01:11
-
-
Save kcmr/ed616eac735874e77adb to your computer and use it in GitHub Desktop.
Gulpfile template: compile scss + autoprefixer + browserSync reload
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 sass = require('gulp-sass'); | |
var browserSync = require('browser-sync'); | |
var autoprefixer = require('gulp-autoprefixer'); | |
gulp.task('sass', function() { | |
return gulp.src('scss/**/*.scss') | |
.pipe(sass()) | |
.pipe(autoprefixer({ | |
browsers: ['last 2 versions'] | |
})) | |
.pipe(gulp.dest('css')) | |
.pipe(browserSync.reload({ | |
stream: true | |
})); | |
}); | |
gulp.task('browserSync', function() { | |
browserSync({ | |
server: { | |
baseDir: './' | |
}, | |
open: true, | |
notify: false, | |
ghostMode: false | |
}); | |
}); | |
gulp.task('watch', ['browserSync', 'sass'], function() { | |
gulp.watch('scss/**/*.scss', ['sass']); | |
gulp.watch('*.html', browserSync.reload); | |
gulp.watch('js/**/*.js', browserSync.reload); | |
}); |
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
{ | |
"name": "<project-name>", | |
"devDependencies": { | |
"browser-sync": "^2.10.1", | |
"gulp": "^3.9.0", | |
"gulp-autoprefixer": "^3.1.0", | |
"gulp-sass": "^2.1.1" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment