build
This commit is contained in:
parent
13d9caf677
commit
5c0b1ba655
25 changed files with 2923 additions and 0 deletions
39
node_modules/@siimple/modules/index.js
generated
vendored
Normal file
39
node_modules/@siimple/modules/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
import {elements} from "./elements.js";
|
||||
import {helpers} from "./helpers.js";
|
||||
import {markup} from "./markup.js";
|
||||
import {reset} from "./reset.js";
|
||||
|
||||
const all = {
|
||||
...elements,
|
||||
...helpers,
|
||||
markup,
|
||||
reset,
|
||||
};
|
||||
|
||||
export const injectModules = config => {
|
||||
const styles = {};
|
||||
// Check for array --> only include specified modules
|
||||
if (config.modules && Array.isArray(config.modules)) {
|
||||
config.modules.forEach(key => {
|
||||
all[key] && Object.assign(styles, all[key]);
|
||||
});
|
||||
}
|
||||
// Check for object or undefined --> exclude modules
|
||||
else if (typeof config.modules === "undefined" || config.modules) {
|
||||
const excludeModules = new Set();
|
||||
Object.keys(config.modules || {}).forEach(key => {
|
||||
if (typeof config.modules[key] === "boolean" && !config.modules[key]) {
|
||||
excludeModules.add(key);
|
||||
}
|
||||
});
|
||||
Object.keys(all).forEach(key => {
|
||||
!excludeModules.has(key) && Object.assign(styles, all[key]);
|
||||
});
|
||||
}
|
||||
return Object.assign(config, {
|
||||
styles: {
|
||||
...styles,
|
||||
...(config.styles || {}),
|
||||
},
|
||||
});
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue