Skip to content

Commit ead2efb

Browse files
authored
fix(build): one single component does not build
When trying to only compile one single component, for example doing this in semantic.json "components": ["popup"], the build does not compile anything. That's because the used micromatch/braces lib expects at least 2 entries so {popup,segment} would work, but {popup} does not. That leads to gulp not finding any file match, thus not compiling anything.
1 parent 845150e commit ead2efb

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

tasks/build/css.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,9 @@ function buildCSS(src, type, config, opts, callback) {
134134
}
135135

136136
if (globs.individuals !== undefined && typeof src === 'string') {
137-
const individuals = config.globs.individuals.replace(/\{/g,'');
138-
const components = config.globs.components.replace(/\}/g,',').concat(individuals);
137+
const components = config.globs.components.replace(/[{}]/g,'') + ',' + config.globs.individuals.replace(/[{}]/g,'');
139138

140-
src = config.paths.source.definitions + '/**/' + components + '.less';
139+
src = config.paths.source.definitions + '/**/{' + components + '}.less';
141140
}
142141

143142
const buildUncompressed = () => build(src, type, false, config, opts);

tasks/build/javascript.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,9 @@ function buildJS(src, type, config, callback) {
101101
}
102102

103103
if (globs.individuals !== undefined && typeof src === 'string') {
104-
const individuals = config.globs.individuals.replace(/\{/g,'');
105-
const components = config.globs.components.replace(/\}/g,',').concat(individuals);
104+
const components = config.globs.components.replace(/[{}]/g,'') + ',' + config.globs.individuals.replace(/[{}]/g,'');
106105

107-
src = config.paths.source.definitions + '/**/' + components + (config.globs.ignored || '') + '.js';
106+
src = config.paths.source.definitions + '/**/{' + components + '}' + (config.globs.ignored || '') + '.js';
108107
}
109108

110109
// copy source javascript

tasks/config/project/config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,10 @@ module.exports = {
138138
const componentsExceptIndividuals = components.filter((component) => !individuals.includes(component));
139139

140140
// takes component object and creates file glob matching selected components
141-
config.globs.components = '{' + componentsExceptIndividuals.join(',') + '}';
141+
config.globs.components = componentsExceptIndividuals.length === 1 ? componentsExceptIndividuals[0] : '{' + componentsExceptIndividuals.join(',') + '}';
142142

143143
// components that should be built, but excluded from main .css/.js files
144-
config.globs.individuals = (individuals.length >= 1)
144+
config.globs.individuals = individuals.length === 1 ? individuals[0] : (individuals.length > 1)
145145
? '{' + individuals.join(',') + '}'
146146
: undefined
147147
;

0 commit comments

Comments
 (0)