Skip to content

Commit b82260a

Browse files
committed
watch this
1 parent 697edbc commit b82260a

File tree

5 files changed

+32
-16
lines changed

5 files changed

+32
-16
lines changed

gulp-tasks/module-tasks/scripts-task.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,18 @@ var filter = require('../lib/gulp-mini-filter.js');
1111

1212
module.exports = function (gulp, module) {
1313

14+
var inputFiles = [
15+
path.join(module.folders.src, module.name + '.js'),
16+
path.join(module.folders.src, '**/*.js'),
17+
path.join(module.folders.dest, module.name + '-templates.js'),
18+
'!**/*.test.js',
19+
'!**/*.ignore.js'
20+
];
21+
22+
module.watch('scripts-watch', function() {
23+
gulp.watch(inputFiles, [ module.name + '-scripts' ]);
24+
});
25+
1426
module.task('scripts-clean', function() {
1527
var outputFiles = [
1628
path.join(module.folders.dest, module.name + '.js'),
@@ -35,15 +47,7 @@ module.exports = function (gulp, module) {
3547
// 1. concat all js in one file and persist to the filesystem
3648
// 2. uglify the previous file and point point the content of the source map to the original file.
3749

38-
var jsGlob = [
39-
path.join(module.folders.src, module.name + '.js'),
40-
path.join(module.folders.src, '**/*.js'),
41-
path.join(module.folders.dest, module.name + '-templates.js'),
42-
'!**/*.test.js',
43-
'!**/*.ignore.js'
44-
];
45-
46-
return gulp.src(jsGlob)
50+
return gulp.src(inputFiles)
4751
.pipe(module.touch())
4852
.pipe(wrap({
4953
header: {

gulp-tasks/module-tasks/templates-task.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@ var config = require('../../build-config.js');
1515

1616
module.exports = function(gulp, module) {
1717

18+
var inputFiles = [
19+
path.join(module.folders.src, '**/*.ng.html'),
20+
path.join(module.folders.src, '**/*.ng.svg')
21+
];
22+
23+
module.watch('templates-watch', function() {
24+
gulp.watch(inputFiles, [ module.name + '-templates' ]);
25+
});
26+
1827
module.task('templates-clean', function() {
1928

2029
var outputFiles = [
@@ -35,6 +44,11 @@ module.exports = function(gulp, module) {
3544
'!**/*.ignore.ng.html'
3645
];
3746

47+
var ngSvgGlob = [
48+
path.join(module.folders.src, '/**/*.ng.svg'),
49+
'!**/*.ignore.ng.svg'
50+
];
51+
3852
var ngHtmlStream = gulp.src(ngHtmlGlob)
3953
.pipe(module.touch())
4054
.pipe(minifyHtml({
@@ -43,11 +57,6 @@ module.exports = function(gulp, module) {
4357
quotes: true
4458
}));
4559

46-
var ngSvgGlob = [
47-
path.join(module.folders.src, '/**/*.ng.svg'),
48-
'!**/*.ignore.ng.svg'
49-
];
50-
5160
var ngSvgStream = gulp.src(ngSvgGlob)
5261
.pipe(module.touch())
5362
.pipe(svgmin());

gulpfile.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ require('./gulp-tasks/modules-task.js')(gulp);
1717
// - - - - 8-< - - - - - - - - - - - - - - - - - - -
1818

1919
gulp.task('build', [ 'modules', 'bower', 'index' ]);
20+
gulp.task('watch', [ 'modules-watch']);
2021
gulp.task('default', [ 'build' ]);
2122

2223
// - - - - 8-< - - - - - - - - - - - - - - - - - - -

src/angular-logo/angular-logo.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@
2525
opacity: 0;
2626
transform: translateY(-50%);
2727
}
28-
}
28+
}

watch.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55

66
# https://github.com/gulpjs/gulp/issues/216
77

8-
until gulp modules-watch
8+
gulp build
9+
10+
until gulp watch
911
do growlnotify -name gulp -m "gulp watch restarted"
1012
sleep 1
1113
done

0 commit comments

Comments
 (0)