Skip to content

Commit

Permalink
chore(idux): add resolver importStyleTheme option (#402)
Browse files Browse the repository at this point in the history
  • Loading branch information
liuzaijiang committed May 27, 2022
1 parent a184a0a commit 4d12348
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/core/resolvers/idux.ts
Expand Up @@ -27,6 +27,12 @@ export interface IduxResolverOptions {
* import style along with components
*/
importStyle?: 'css' | 'less'
/**
* theme for import style
*
* @default 'default'
*/
importStyleTheme?: string
}

/**
Expand All @@ -38,7 +44,7 @@ export function IduxResolver(options: IduxResolverOptions = {}): ComponentResolv
return {
type: 'component',
resolve: (name: string) => {
const { importStyle, exclude = [] } = options
const { importStyle, importStyleTheme = 'default', exclude = [] } = options
if (exclude.includes(name))
return

Expand All @@ -56,7 +62,7 @@ export function IduxResolver(options: IduxResolverOptions = {}): ComponentResolv

let sideEffects: string | undefined
if (packageName !== 'cdk' && importStyle)
sideEffects = `${path}/style/themes/${importStyle === 'css' ? 'default_css' : 'default'}`
sideEffects = `${path}/style/themes/${importStyle === 'css' ? `${importStyleTheme}_css` : importStyleTheme}`

return { name, from: path, sideEffects }
},
Expand Down

0 comments on commit 4d12348

Please sign in to comment.