主题
预设
¥Presets
预设是 UnoCSS 的核心。它们可以让你在几分钟内创建自己的自定义框架。
¥Presets are the heart of UnoCSS. They let you make your own custom framework in minutes.
使用预设
¥Using presets
为你的项目设置预设:
¥To set presets to your project:
ts
import { defineConfig, presetAttributify, presetUno } from 'unocss'
export default defineConfig({
presets: [
presetAttributify({ /* preset options */}),
presetUno(),
// ...custom presets
],
})
当指定 presets
选项时,默认预设将被忽略。
¥When the presets
option is specified, the default preset will be ignored.
要禁用默认预设,你可以将 presets
设置为空数组:
¥To disable the default preset, you can set presets
to an empty array:
ts
import { defineConfig } from 'unocss'
export default defineConfig({
presets: [], // disable default preset
rules: [
// your custom rules
],
})
¥You can check official presets and community presets for more.
创建预设
¥Creating presets
要了解如何创建自己的自定义预设,请参阅 配置:presets。
¥To see how you can create your own custom preset, see Config: presets.