Skip to content

Commit afbf492

Browse files
authored
fix(build): prevent gulp watch task from refreshing all components
When defining individuals inside semantic.json, these components are added to the list of regular components inside the build function. The problem is that this build function is also used by the 'watch' task to refresh individual files. So when running gulp watch with individuals defined, the src variable containing the path to the watched file is overwritten by the full list of components. The result is that each change triggers a full rebuild. Not what we want, so I added an extra condition to the if statement that's changing the src variable. It seems the src variable is always passed as object when using watch.. So by checking if src is a string, it is only altered during regular build tasks.
1 parent 323e608 commit afbf492

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

tasks/build/css.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ function buildCSS(src, type, config, opts, callback) {
127127
src = config.paths.source.definitions + '/**/' + config.globs.components + '.less';
128128
}
129129

130-
if (globs.individuals !== undefined) {
130+
if (globs.individuals !== undefined && typeof src === 'string') {
131131
const individuals = config.globs.individuals.replace('{','');
132132
const components = config.globs.components.replace('}',',').concat(individuals);
133133

tasks/build/javascript.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ function buildJS(src, type, config, callback) {
9999
src = config.paths.source.definitions + '/**/' + config.globs.components + (config.globs.ignored || '') + '.js';
100100
}
101101

102-
if (globs.individuals !== undefined) {
102+
if (globs.individuals !== undefined && typeof src === 'string') {
103103
const individuals = config.globs.individuals.replace('{','');
104104
const components = config.globs.components.replace('}',',').concat(individuals);
105105

0 commit comments

Comments
 (0)