42 lines
1.1 KiB
JavaScript
42 lines
1.1 KiB
JavaScript
'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']);
|
|
|
|
gulp.watch([
|
|
path.join(conf.paths.src, '/sass/**/*.css'),
|
|
path.join(conf.paths.src, '/sass/**/*.scss')
|
|
], function(event) {
|
|
if(isOnlyChange(event)) {
|
|
gulp.start('styles-reload');
|
|
} else {
|
|
gulp.start('inject-reload');
|
|
}
|
|
});
|
|
|
|
gulp.watch(path.join(conf.paths.src, '/app/**/*.js'), function(event) {
|
|
if(isOnlyChange(event)) {
|
|
gulp.start('scripts-reload');
|
|
} else {
|
|
gulp.start('inject-reload');
|
|
}
|
|
});
|
|
|
|
gulp.watch(path.join(conf.paths.src, '/app/**/*.html'), function(event) {
|
|
var projectPath = path.join(process.cwd(),conf.paths.src);
|
|
projectPath = event.path.replace(projectPath, '').replace(/\\/g, '/');
|
|
browserSync.notify({reload: projectPath});//Push notification to clien with browserSync
|
|
});
|
|
});
|