Skip to content

Commit

Permalink
// 因為gulp-watch只要資料夾沒檔案會導致之後修改新增檔案都不會觸發
Browse files Browse the repository at this point in the history
// 所以在/js/vendor與js/lib/寫一個_.js來進行第一次觸發, 如果資料夾有檔案後就可以將此js刪除
// bug report: shama/gaze#103
  • Loading branch information
Hank Kuo committed Dec 5, 2014
1 parent 2dc439f commit 78fb2de
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
11 changes: 6 additions & 5 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ var filefolder = {
'img': 'img/**/*',
'js': {
'all': 'js/**/*.js',
'lib': 'js/lib/**/*',
'script': 'js/script/**/*',
'vendor': 'js/vendor/**/*'
'lib': 'js/lib/**/*.js',
'script': 'js/script/**/*.js',
'vendor': 'js/vendor/**/*.js'
},
'html': 'html/**/*.html',
'htmldist': 'dist/html/**/*.html',
Expand Down Expand Up @@ -483,9 +483,12 @@ gulp.task('test-js', function() {
// 監聽js/script檔案, 產生對應的測試用html
// 測試用的html會自動加上測試用的lib與測試用的js
// 測試用的html與js如果已存在則不覆蓋(避免使用者新增的部分被覆蓋掉)
// 如果資料夾裡面都沒有任何js檔案, watch會失效
gulp.src(jsTestFolderAry)
.pipe(watch(jsTestFolderAry, function(files) {

console.log(1234);

files.pipe(tap(function(file, t) {

var name = getPathName(file.path);
Expand All @@ -498,8 +501,6 @@ gulp.task('test-js', function() {
.pipe(reload({
stream: true
}));


});

// 哪些檔案有更新就要reload畫面
Expand Down
3 changes: 3 additions & 0 deletions js/lib/_.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// 因為gulp-watch只要資料夾沒檔案會導致之後修改新增檔案都不會觸發
// 所以寫一個_.js來觸發, 如果資料夾有檔案後就可以將此js刪除
// bug report: https://github.com/shama/gaze/pull/103
3 changes: 3 additions & 0 deletions js/script/_.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// 因為gulp-watch只要資料夾沒檔案會導致之後修改新增檔案都不會觸發
// 所以寫一個_.js來觸發, 如果資料夾有檔案後就可以將此js刪除
// bug report: https://github.com/shama/gaze/pull/103

0 comments on commit 78fb2de

Please sign in to comment.