Skip to content

Commit

Permalink
fix(build): single individuals element breaks build
Browse files Browse the repository at this point in the history
It seems that the current logic (below) to create file blob like {foo,bar,buz}.less assumes that config.globs.individuals is always like {a,b,c}, but it does not when individuals has only one single element.
After This PR, config.globs.components and config.globs.individuals are {a,b,c} if those arrays has 1 or more elements, so build/css.js and build/javascript.js works regardless of the number of elements in individuals/components
  • Loading branch information
exoego authored Aug 12, 2020
1 parent 7445821 commit 6957237
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions tasks/config/project/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,18 +128,14 @@ module.exports = {
}

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

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

Expand Down

0 comments on commit 6957237

Please sign in to comment.