Created
July 3, 2018 16:54
-
-
Save markmichon/1599b7ab3dc5511c2b68a7494a8a8f24 to your computer and use it in GitHub Desktop.
Example gulpfile with browsersync and gulp-sass
This file contains hidden or 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
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