blur-admin/gulp/watch.js

40 lines
934 B
JavaScript
Raw Normal View History

2015-12-10 16:22:20 +00:00
'use strict';
var path = require('path');
var gulp = require('gulp');
var conf = require('./conf');
var browserSync = require('browser-sync');
function isOnlyChange(event) {
return event.type === 'changed';
}
gulp.task('watch', ['inject'], function () {
gulp.watch([path.join(conf.paths.src, '/*.html'), 'bower.json'], ['inject-reload']);
2015-12-10 16:22:20 +00:00
gulp.watch([
2015-12-17 11:31:11 +00:00
path.join(conf.paths.src, '/sass/**/*.css'),
path.join(conf.paths.src, '/sass/**/*.scss')
2015-12-10 16:22:20 +00:00
], function(event) {
if(isOnlyChange(event)) {
gulp.start('styles-reload');
2015-12-10 16:22:20 +00:00
} else {
gulp.start('inject-reload');
2015-12-10 16:22:20 +00:00
}
});
gulp.watch(path.join(conf.paths.src, '/app/**/*.js'), function(event) {
if(isOnlyChange(event)) {
gulp.start('scripts-reload');
2015-12-10 16:22:20 +00:00
} else {
gulp.start('inject-reload');
2015-12-10 16:22:20 +00:00
}
});
gulp.watch(path.join(conf.paths.src, '/app/**/*.html'), function(event) {
browserSync.reload(event.path);
});
});