Gulp makes no changes -
i'm starting gulp, don't error seems gulp.watch don't work.
server starts , compile, not refresh changes.
comment lines simplify tasks.
node version: 4.4.7
cli version 1.2.2
local version 3.9.1
os: win7
my gulpfile.js
'use strict'; var gulp = require('gulp'); var less = require('gulp-less'); var browsersync = require('browser-sync').create(); var jade = require('gulp-jade'); var concat = require('gulp-concat'); gulp.task('less', function() { return gulp.src("./des/less/estilos.less") .pipe(less()) .pipe(gulp.dest("./prod/css/")) .pipe(browsersync.stream()); }); gulp.task('less:watch', function () { gulp.watch('./des/less/*.less', ['less']); }); gulp.task('templates', function() { gulp.src('./des/jades/*.jade') .pipe(jade({ pretty: true })) .pipe(gulp.dest('./prod')) .pipe(browsersync.stream()); }); gulp.task('scripts', function() { //return gulp.src(['./lib/file3.js', './lib/file1.js', './lib/file2.js']) return gulp.src('./des/js/*.js') .pipe(concat('all.js')) .pipe(gulp.dest('./prod/js/')) .pipe(browsersync.stream()); }); gulp.task('serve', ['less','templates'], function() { browsersync.init({ server: "./prod", port: 3000, browser: ["chrome", "firefox"], watchoptions : { ignored : 'node_modules/*', ignoreinitial : true } }); gulp.task('watch', function() { gulp.watch(["./des/jades/*.jade"], ['templates']); // gulp.watch("./**/*.less", ['less']); // gulp.watch("./**/*.js", ['scripts']); // gulp.watch("./**/*.css").on('change', browsersync.reload); gulp.watch("./prod/*.html").on('change', browsersync.reload); // gulp.watch("./**/*.js").on('change', browsersync.reload); }); }); // gulp.task('default', ['less','lesspublic','lesscommon','templates','serve']); gulp.task('default', ['less','templates', 'scripts', 'serve']);
thank help
your problem var browsersync pointing create object of "browser-sync" , chaining "stream" object not work because no instance of create object.
you should change
var browsersync = require('browser-sync').create();
to
var browsersync = require('browser-sync');
with should scope existing objects of browsersync
browsersync.init(); browsersync.create(); browsersync.stream();
Comments
Post a Comment