// Reload Browsers gulp.task('browser-sync', function () { browserSync.init(files, options); gulp.watch(config.js + '**/*.js', ['js']); gulp.watch(config.styl + '**/*.styl', ['stylus']); gulp.watch([config.dev + '**/*.html', config.dev + '**/*.txt'], ['move']); gulp.watch(files).on('change', browserSync.reload); });
watcher.on('change', function(event) { console.log('File ' + event.path + ' was ' + event.type + ', running tasks...'); });
gulp.task('serve', ['build-dev'], function() { gulp.watch(paths.styles.src + '/**/*', ['styles']); gulp.watch(paths.assets.src + '/**/*', ['copy-assets']); gulp.watch(paths.script.src + '/**/*.js', ['lint', 'scripts']); gulp.watch(paths.config.entry, ['config-dev']); gulp.watch(paths.base + '/index.html', ['copy-html']); gulp.watch(paths.base + '/templates/**/*', ['copy-html']); gulp.watch(paths.build + '/**/*').on('change', browserSync.reload); browserSync.init({ server: paths.build }); });
// This is the default task - which is run when `gulp` is run // The tasks passed in as an array are run before the tasks within the function gulp.task('default', ['sass'], function() { // Watch the files in the paths object, and when there is a change, fun the functions in the array gulp.watch(paths.styles.files, ['sass']) // Also when there is a change, display what file was changed, only showing the path after the 'sass folder' .on('change', function(evt) { console.log( '[watcher] File ' + evt.path.replace(/.*(?=sass)/,'') + ' was ' + evt.type + ', compiling...' ); }); });
// this task wil watch for changes // to js, html, and css files and call the // reportChange method. Also, by depending on the // serve task, it will instantiate a browserSync session gulp.task('watch', ['serve'], function() { gulp.watch(paths.source, ['build-system', browserSync.reload]).on('change', reportChange); gulp.watch(paths.html, ['build-html', browserSync.reload]).on('change', reportChange); gulp.watch(paths.css, ['build-css', browserSync.reload]).on('change', reportChange); gulp.watch(paths.style, browserSync.reload).on('change', reportChange); });
// Watching scss/less/html files gulp.task('watch', ['serve', 'sass', 'js'], function() { gulp.watch('src/scss/**/*.scss', ['sass']); gulp.watch('src/js/**/*.js', ['js']); gulp.watch('src/index.html').on('change', browserSync.reload); });
gulp.task('watch', function() { live.listen(); gulp.watch( 'src/**/**', [ 'browserify', 'styles' ]).on('change', live.changed); });
gulp.task('watch', ['serve'], function() { gulp.watch(paths.source, ['build-system', browserSync.reload]).on('change', reportChange); gulp.watch(paths.html, ['build-html', browserSync.reload]).on('change', reportChange); gulp.watch(paths.style, ['build-styles']).on('change', reportChange); gulp.watch(paths.style, function() { return gulp.src(paths.style) .pipe(browserSync.stream()); }).on('change', reportChange); });
// Watch JS/JSX files gulp.task('watch', function() { gulp.watch('*.{js,jsx,html}').on("change",reload); });
gulp.task('watch', ['nodemon', 'browser-sync'], function() { gulp.watch(path.source, ['build-system', browserSync.reload]).on('change', reportChange); gulp.watch(path.html, ['build-html', browserSync.reload]).on('change', reportChange); gulp.watch(path.style, browserSync.reload).on('change', reportChange); });
// this task wil watch for changes // to js, html, and css files and call the // reportChange method. Also, by depending on the // serve task, it will instantiate a browserSync session gulp.task('watch', ['serve'], function() { gulp.watch(paths.source, ['build-system', browserSync.reload]).on('change', reportChange); gulp.watch(paths.html, ['build-html', browserSync.reload]).on('change', reportChange); gulp.watch(paths.css, ['build-css']).on('change', reportChange); gulp.watch(paths.style, function() { return gulp.src(paths.style) .pipe(browserSync.stream()); }).on('change', reportChange); });
// this task wil watch for changes // to js, html, and css files and call the // reportChange method. Also, by depending on the // serve task, it will instantiate a browserSync session gulp.task('watch', ['serve'], function() { gulp.watch(paths.source, ['build-system', browserSync.reload]).on('change', reportChange); gulp.watch(paths.html, ['build-html', browserSync.reload]).on('change', reportChange); gulp.watch(paths.serverSource, ['build-server', browserify.reload]).on('change', reportChange); gulp.watch(paths.style, browserSync.reload).on('change', reportChange); });
// Reload Browsers gulp.task('browser-sync', function () { browserSync.init(files, options); gulp.watch(config.js + '**/*.js', ['js']); gulp.watch(config.styl + '**/*.styl', ['stylus']); gulp.watch([config.dev + '**/*.html', config.dev + '**/*.txt'], ['move']); gulp.watch(files).on('change', browserSync.reload); });
gulp.task(WATCH_JS, function() { gulp.watch(JS_SRC, [MINIFY_JS]).on('change', watcherHandler); });