provide corePlugins helper when running plugins

master
Brad Cornes 2020-06-11 12:10:47 +01:00
parent 5f6b8e3f4e
commit bdfe43a639
1 changed files with 6 additions and 0 deletions

View File

@ -17,6 +17,12 @@ export function runPlugin(plugin, params = {}) {
theme: (path, defaultValue) => dlv(config, `theme.${path}`, defaultValue),
variants: () => [],
config: (path, defaultValue) => dlv(config, path, defaultValue),
corePlugins: (path) => {
if (Array.isArray(config.corePlugins)) {
return config.corePlugins.includes(path)
}
return dlv(config, `corePlugins.${path}`, true)
},
target: (path) => {
if (typeof config.target === 'string') {
return config.target === 'browserslist'