Skip to content
On this page

Svelte 提取器

支持从 class: 指令中提取类。

html
<div class:text-orange-400="{foo}" />
<div class:text-orange-400="{foo}" />

将被提取为 text-orange-400 并生成:

css
.text-orange-400 {
  color: #f6993f;
}
.text-orange-400 {
  color: #f6993f;
}

安装

bash
pnpm add -D @unocss/extractor-svelte
pnpm add -D @unocss/extractor-svelte
bash
yarn add -D @unocss/extractor-sve
yarn add -D @unocss/extractor-sve
bash
npm install -D @unocss/extractor-sve
npm install -D @unocss/extractor-sve
ts
// uno.config.js
import { defineConfig } from 'unocss'
import extractorSvelte from '@unocss/extractor-svelte'

export default defineConfig({
  extractors: [extractorSvelte()]
})
// uno.config.js
import { defineConfig } from 'unocss'
import extractorSvelte from '@unocss/extractor-svelte'

export default defineConfig({
  extractors: [extractorSvelte()]
})

Released under the MIT License.