Skip to content

Commit

Permalink
fix(build): one single component does not build
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
lubber-de authored Nov 14, 2022
1 parent 845150e commit ead2efb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
5 changes: 2 additions & 3 deletions tasks/build/css.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,9 @@ function buildCSS(src, type, config, opts, callback) {
}

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

src = config.paths.source.definitions + '/**/' + components + '.less';
src = config.paths.source.definitions + '/**/{' + components + '}.less';
}

const buildUncompressed = () => build(src, type, false, config, opts);
Expand Down
5 changes: 2 additions & 3 deletions tasks/build/javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,9 @@ function buildJS(src, type, config, callback) {
}

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

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

// copy source javascript
Expand Down
4 changes: 2 additions & 2 deletions tasks/config/project/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,10 @@ module.exports = {
const componentsExceptIndividuals = components.filter((component) => !individuals.includes(component));

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

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

0 comments on commit ead2efb

Please sign in to comment.