Add support for presets
This commit is contained in:
parent
3553b5912e
commit
f876304557
2 changed files with 10 additions and 0 deletions
|
|
@ -102,6 +102,15 @@ function resolveInternal(ctx: ResolutionContext, user: UserConfig): void {
|
|||
}
|
||||
}
|
||||
|
||||
// Apply configs from presets
|
||||
if (Array.isArray(user.presets) && user.presets.length === 0) {
|
||||
throw new Error('The empty preset `[]` is not supported')
|
||||
}
|
||||
|
||||
for (let preset of user.presets ?? []) {
|
||||
resolveInternal(ctx, preset)
|
||||
}
|
||||
|
||||
// Apply configs from plugins
|
||||
for (let plugin of plugins) {
|
||||
ctx.plugins.push(plugin)
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import type { PluginUtils } from './resolve-config'
|
|||
export type ResolvableTo<T> = T | ((utils: PluginUtils) => T)
|
||||
|
||||
export interface UserConfig {
|
||||
presets?: UserConfig[]
|
||||
theme?: ThemeConfig
|
||||
plugins?: Plugin[]
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue