Skip to content

Svelte 提取器

¥Svelte Extractor

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

¥Supports extracting classes from class: directive.

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

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

¥Will be extracted as text-orange-400 and generates:

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

安装

¥Installation

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

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