Skip to content

Instantly share code, notes, and snippets.

@jacurtis
Created July 26, 2016 23:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jacurtis/76c1916d47dc424d62a3b4eb81b7fa7f to your computer and use it in GitHub Desktop.
Save jacurtis/76c1916d47dc424d62a3b4eb81b7fa7f to your computer and use it in GitHub Desktop.
My Default Gulpfile.js configuration. Using sass and browsersync
var gulp = require('gulp');
var sass = require('gulp-sass');
var browserSync = require('browser-sync').create();
// Compile Sass + refresh browser sync
gulp.task('styles', function() {
return gulp.src('./sass/**/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('./css'))
.pipe(browserSync.stream());
});
// Launch a quick server
gulp.task('browserSync', function() {
browserSync.init({
server: {
baseDir: './'
}
});
});
// Static Server + watching scss/html files
gulp.task('serve', ['styles'], function() {
browserSync.init({
server: "./"
});
gulp.watch("./sass/*.scss", ['styles']);
gulp.watch("./*.html").on('change', browserSync.reload);
});
// Watch task = updates SASS and refreshes Browser Sync
gulp.task('default', ['serve']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment