Skip to content

Commit e8bc467

Browse files
authored
feat(build): remove individuals from components
So users no need to remove the items in individuals from components, or even can omit components at all.
1 parent da75c3c commit e8bc467

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

tasks/config/project/config.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,22 @@ module.exports = {
127127
});
128128
}
129129

130-
// takes component object and creates file glob matching selected components
131-
config.globs.components = (Array.isArray(config.components) && config.components.length >= 1)
132-
? '{' + config.components.join(',') + '}'
133-
: '{' + defaults.components.join(',') + '}'
130+
const components = (Array.isArray(config.components) && config.components.length >= 1)
131+
? config.components
132+
: defaults.components
133+
;
134+
const individuals = (Array.isArray(config.individuals) && config.individuals.length >= 1)
135+
? config.individuals
136+
: []
134137
;
138+
const componentsExceptIndividuals = components.filter((component) => !individuals.includes(component));
139+
140+
// takes component object and creates file glob matching selected components
141+
config.globs.components = '{' + componentsExceptIndividuals.join(',') + '}';
135142

136143
// components that should be built, but excluded from main .css/.js files
137-
config.globs.individuals = (Array.isArray(config.individuals) && config.individuals.length >= 1)
138-
? '{' + config.individuals.join(',') + '}'
144+
config.globs.individuals = (individuals.length >= 1)
145+
? '{' + individuals.join(',') + '}'
139146
: undefined
140147
;
141148

0 commit comments

Comments
 (0)