Skip to content

Commit

Permalink
fix(@unocss/vite): map vfsLayers to unocss layers
Browse files Browse the repository at this point in the history
  • Loading branch information
zoeyzhao19 committed Jul 5, 2023
1 parent 757b7f1 commit 23d64a5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/vite/src/modes/global/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,12 @@ export function GlobalModeBuildPlugin(ctx: UnocssPluginContext<VitePluginConfig>
return null
}
const result = await generateAll()
const mappedVfsLayer = Array.from(vfsLayers).map(layer => layer === LAYER_MARK_ALL ? layer : layer.replace(/^_/, ''))
const cssWithLayers = Array.from(vfsLayers).map(layer =>
`#--unocss-layer-start--${layer}--{start:${layer}} ${
layer === LAYER_MARK_ALL
? result.getLayers(undefined, Array.from(vfsLayers))
: (result.getLayer(layer) || '')
? result.getLayers(undefined, mappedVfsLayer)
: (result.getLayer(layer.replace(/^_/, '')) || '')
} #--unocss-layer-end--${layer}--{end:${layer}}`,
).join('')

Expand Down

0 comments on commit 23d64a5

Please sign in to comment.