Skip to content

Instantly share code, notes, and snippets.

@riskiii
Forked from timothyjensen/Gulpfile.js
Created February 21, 2017 03:03
Show Gist options
  • Save riskiii/7b0e10cd2aac01c2002e5ebaa3738eee to your computer and use it in GitHub Desktop.
Save riskiii/7b0e10cd2aac01c2002e5ebaa3738eee to your computer and use it in GitHub Desktop.
Automate compiling Sass to CSS and browser refresh using BrowserSync
// Require our dependencies
var gulp = require('gulp');
var sass = require('gulp-sass');
var browserSync = require('browser-sync').create();
gulp.task('styles', function(){
return gulp.src('sass/style.scss')
.pipe(sass({
outputStyle: 'expanded', // Options: nested, expanded, compact, compressed
indentType: 'tab',
indentWidth: 1
})) // Converts Sass to CSS with gulp-sass
.pipe(gulp.dest('./'))
.pipe(browserSync.reload({stream: true}));
});
// Gulp watch syntax
gulp.task('serve', function(){
// Kick off BrowserSync.
browserSync.init({
proxy: "www.example.dev"
});
gulp.watch('sass/**/*.scss', ['styles']);
});
// Default Gulp task
gulp.task('default',['styles', 'serve']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment