主题
提取器
🌐 Extractors
提取器用于从源代码中提取工具的使用情况。
🌐 Extractors are used to extract the usage of utilities from your source code.
ts
import { defineConfig } from 'unocss'
export default defineConfig({
extractors: [
// your extractors
],
})默认情况下,extractorSplit 将始终被应用,它会将源代码拆分成标记并直接输入引擎。
🌐 By default extractorSplit will always be applied, which splits the source code into tokens and directly feed to the engine.
要覆盖默认的提取器,你可以使用 extractorDefault 选项。
🌐 To override the default extractors, you can use extractorDefault option.
ts
import { defineConfig } from 'unocss'
export default defineConfig({
extractors: [
// your extractors
],
// disable the default extractor
extractorDefault: false,
// override the default extractor with your own
extractorDefault: myExtractor,
})例如,请查看 pug 提取器 或 attributify 提取器 的实现。
🌐 For example, please check the implementation of pug extractor or the attributify extractor.