Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit 560bf2b

Browse files
filipesilvanaomiblack
authored andcommitted
chore: optimize gulp watchers
Reduce amount of watchers for `gulp serve-and-sync-devguide` by roughly 50% (~4900-ish to ~2500). This should help with the 100% CPU usage #1082, on my machine it went from ~90% to ~50%. At the end of the day we're still watching an insane amount of files, so it is a demanding process. Maybe using better watcher libs would also help.
1 parent 4e73185 commit 560bf2b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

gulpfile.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ var DOCS_PATH = path.join(PUBLIC_PATH, 'docs');
3737

3838
var EXAMPLES_PATH = path.join(DOCS_PATH, '_examples');
3939
var EXAMPLES_PROTRACTOR_PATH = path.join(EXAMPLES_PATH, '_protractor');
40-
var NOT_API_DOCS_GLOB = path.join(PUBLIC_PATH, './{docs/*/latest/!(api),!(docs)}/**/*');
40+
var NOT_API_DOCS_GLOB = path.join(PUBLIC_PATH, './{docs/*/latest/!(api),!(docs)}/**/*.*');
4141
var RESOURCES_PATH = path.join(PUBLIC_PATH, 'resources');
4242
var LIVE_EXAMPLES_PATH = path.join(RESOURCES_PATH, 'live-examples');
4343

@@ -989,6 +989,7 @@ function devGuideExamplesWatch(shredOptions, postShredAction) {
989989
// gulp.watch([includePattern, excludePattern], {readDelay: 500}, function (event, done) {
990990
var ignoreThese = [ '**/node_modules/**', '**/_fragments/**', '**/dist/**', '**/typings/**',
991991
'**/dart/.pub/**', '**/dart/build/**', '**/dart/packages/**'];
992+
ignoreThese = ignoreThese.concat(_exampleBoilerplateFiles.map((file) => `public/docs/_examples/*/*/${file}`));
992993
var files = globby.sync( [includePattern], { ignore: ignoreThese });
993994
gulp.watch([files], {readDelay: 500}, function (event, done) {
994995
gutil.log('Dev Guide example changed')
@@ -1003,7 +1004,8 @@ function devGuideSharedJadeWatch(shredOptions, postShredAction) {
10031004
// removed this version because gulp.watch has the same glob issue that dgeni has.
10041005
// var excludePattern = '!' + path.join(shredOptions.jadeDir, '**/node_modules/**/*.*');
10051006
// gulp.watch([includePattern, excludePattern], {readDelay: 500}, function (event, done) {
1006-
var files = globby.sync( [includePattern], { ignore: [ '**/node_modules/**', '**/_examples/**', '**/_fragments/**']});
1007+
var ignoreThese = [ '**/node_modules/**', '**/_examples/**', '**/_fragments/**', '**/latest/api/**' ];
1008+
var files = globby.sync( [includePattern], { ignore: ignoreThese});
10071009
gulp.watch([files], {readDelay: 500}, function (event, done) {
10081010
gutil.log('Dev Guide jade file changed')
10091011
gutil.log('Event type: ' + event.type); // added, changed, or deleted

0 commit comments

Comments
 (0)