Created
July 26, 2016 23:46
-
-
Save jacurtis/76c1916d47dc424d62a3b4eb81b7fa7f to your computer and use it in GitHub Desktop.
My Default Gulpfile.js configuration. Using sass and browsersync
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').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