var gulp = require('gulp'),
sequence = require('gulp-sequence'),
changed = require('gulp-changed'),
pug = require('gulp-pug'),
sass = require('gulp-sass'),
browser = require('browser-sync');
gulp.task('server', ['build'], function() {
browser({
server: {baseDir: 'build'},
notify: false
});
});
gulp.task('sass:build', function(){
return gulp.src('src/*.sass')
.pipe(changed('build', {extension: '.css'}))
.pipe(sass())
.pipe(gulp.dest('build'))
});
gulp.task('pug:build', function(){
return gulp.src('src/*.pug')
.pipe(pug())
.pipe(gulp.dest('build'))
});
gulp.task('build',
sequence(['sass:build'], 'pug:build'
));
gulp.task('watch', ['server'], function() {
gulp.watch(['src/*.pug', 'build/*.css'], ['pug:build']);
gulp.watch('src/*.sass', ['sass:build']);
gulp.watch('build/*.html', browser.reload);
});