Skip to content

Commit

Permalink
feat(varlet-ui): support styleExtname option
Browse files Browse the repository at this point in the history
  • Loading branch information
haoziqaq committed Feb 18, 2024
1 parent aeaf51d commit e97499a
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/core/resolvers/varlet-ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ export interface VarletUIResolverOptions {
*/
importStyle?: boolean | 'css' | 'less'

/**
* style entry file extname
*
* @default '.mjs'
*/
styleExtname?: string

/**
* auto import for directives
*
Expand Down Expand Up @@ -48,10 +55,11 @@ const varDirectives = ['Ripple', 'Lazy', 'Hover']
export function getResolved(name: string, options: VarletUIResolverOptions): ComponentResolveResult {
const {
importStyle = 'css',
importCss = true,
importLess,
styleExtname = '.mjs',
autoImport = false,
version = 'vue3',
importCss = true,
importLess,
} = options

const path = version === 'vue2' ? '@varlet-vue2/ui' : '@varlet/ui'
Expand All @@ -61,7 +69,7 @@ export function getResolved(name: string, options: VarletUIResolverOptions): Com
if (importStyle === 'less' || importLess)
sideEffects.push(`${path}/es/${kebabCase(name)}/style/less`)
else
sideEffects.push(`${path}/es/${kebabCase(name)}/style/index`)
sideEffects.push(`${path}/es/${kebabCase(name)}/style/index${styleExtname}`)
}

return {
Expand Down

0 comments on commit e97499a

Please sign in to comment.