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 () {
|
|
|
|
|
2015-12-14 18:22:38 +00:00
|
|
|
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)) {
|
2015-12-14 18:22:38 +00:00
|
|
|
gulp.start('styles-reload');
|
2015-12-10 16:22:20 +00:00
|
|
|
} else {
|
2015-12-14 18:22:38 +00:00
|
|
|
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)) {
|
2015-12-14 18:22:38 +00:00
|
|
|
gulp.start('scripts-reload');
|
2015-12-10 16:22:20 +00:00
|
|
|
} else {
|
2015-12-14 18:22:38 +00:00
|
|
|
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);
|
|
|
|
});
|
|
|
|
});
|