Skip to content

Instantly share code, notes, and snippets.

@sunilw
Last active February 21, 2016 05:08
Show Gist options
  • Save sunilw/c6c781ee2ad471d13ddc to your computer and use it in GitHub Desktop.
Save sunilw/c6c781ee2ad471d13ddc to your computer and use it in GitHub Desktop.
Simple gulpfile. Support for sass, browsersyncs. Sourcemap support yet to be thoroughly tested
var gulp = require('gulp') ;
var sass = require('gulp-sass') ;
var watch = require('gulp-watch') ;
var sourcemaps = require('gulp-sourcemaps');
var browserSync = require('browser-sync');
gulp.task('sass', function () {
return gulp.src('./src/sass/**.scss')
.pipe(watch('./src/sass/**.scss'))
.pipe(sourcemaps.init())
.pipe(sass().on('error', sass.logError))
.pipe(sourcemaps.write())
.pipe(gulp.dest('./css'))
.pipe(browserSync.stream()) ;
});
gulp.task('bs-reload', function () {
browserSync.reload();
});
gulp.task('serve', function() {
browserSync({
files: "css/*.css",
server: {
baseDir: "."
}
});
gulp.watch("./*.html").on('change', browserSync.reload);
gulp.watch("./css/**").on('change', browserSync.reload);
});
gulp.task('default', [ 'sass', 'serve']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment