Skip to content

Instantly share code, notes, and snippets.

@markmichon
Created July 3, 2018 16:54
Show Gist options
  • Save markmichon/1599b7ab3dc5511c2b68a7494a8a8f24 to your computer and use it in GitHub Desktop.
Save markmichon/1599b7ab3dc5511c2b68a7494a8a8f24 to your computer and use it in GitHub Desktop.
Example gulpfile with browsersync and gulp-sass
const gulp = require('gulp')
const sass = require('gulp-sass')
const browserSync = require('browser-sync').create()
const reload = browserSync.reload
gulp.task('sass', ()=> {
return gulp.src('scss/main.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('css'))
.pipe(reload({stream: true}))
})
gulp.task('serve', ['sass'], () => {
browserSync.init({
server: './'
})
gulp.watch('scss/**/*.scss', ['sass'])
gulp.watch('*.html').on('change', reload)
})
gulp.task('default', ['serve'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment