Presets
Presets là trái tim của UnoCSS. Chúng cho phép bạn tạo framework tùy chỉnh riêng của mình trong vài phút.
Sử dụng presets
Để đặt presets cho dự án của bạn:
ts
import { defineConfig, presetAttributify, presetWind3 } from 'unocss'
export default defineConfig({
presets: [
presetAttributify({ /* các tùy chọn preset */}),
presetWind3(),
// ...presets tùy chỉnh
],
})Khi tùy chọn presets được chỉ định, preset mặc định sẽ bị bỏ qua.
Để vô hiệu hóa preset mặc định, bạn có thể đặt presets thành một mảng trống:
ts
import { defineConfig } from 'unocss'
export default defineConfig({
presets: [], // vô hiệu hóa preset mặc định
rules: [
// các quy tắc tùy chỉnh của bạn
],
})Bạn có thể kiểm tra presets chính thức và presets cộng đồng để biết thêm.
Tạo presets
Để xem cách bạn có thể tạo preset tùy chỉnh riêng của mình, xem Cấu hình: presets.