I'm having a little problem with gulp's tasks. I'm trying to listen for file changes with watch and refresh browser with browser sync.
Follow the code:
var gulp = require('gulp');
var sass = require('gulp-sass');
var pug = require('gulp-pug');
var browserSync = require('browser-sync').create();
gulp.task('sass', function(){
return gulp.src('./sass/*scss')
.pipe(sass())
.on('error', function(err){console.log(err.message); })
.pipe(gulp.dest('./dist/css'))
});
gulp.task('pug', function(){
return gulp.src('./views/*.pug')
.pipe(pug())
.pipe(gulp.dest('./dist/pages'))
});
gulp.task('browserSync', function(){
return browserSync.init(['./dist/pages','./dist/css/*css', './dist/js/*js'], {
server:{
baseDir: './'
}
})
});
gulp.task('default', ['pug', 'sass', 'browserSync'], function(){
gulp.watch('./')
});
My Folder Hierarchy:
The message appears in the browser:
Cannot GET /