You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
911 B
JavaScript
39 lines
911 B
JavaScript
'use strict';
|
|
|
|
var gulp = require('gulp');
|
|
var browserSync = require('browser-sync');
|
|
|
|
function isOnlyChange(event) {
|
|
return event.type === 'changed';
|
|
}
|
|
|
|
module.exports = function(options) {
|
|
gulp.task('watch', ['inject'], function () {
|
|
|
|
gulp.watch([options.src + '/*.html', 'bower.json'], ['inject']);
|
|
|
|
gulp.watch([
|
|
options.src + '/{app,components}/**/*.css',
|
|
options.src + '/{app,components}/**/*.scss'
|
|
], function(event) {
|
|
if(isOnlyChange(event)) {
|
|
gulp.start('styles');
|
|
} else {
|
|
gulp.start('inject');
|
|
}
|
|
});
|
|
|
|
gulp.watch(options.src + '/{app,components}/**/*.js', function(event) {
|
|
if(isOnlyChange(event)) {
|
|
gulp.start('scripts');
|
|
} else {
|
|
gulp.start('inject');
|
|
}
|
|
});
|
|
|
|
gulp.watch(options.src + '/{app,components}/**/*.html', function(event) {
|
|
browserSync.reload(event.path);
|
|
});
|
|
});
|
|
};
|