Skip to content

Presets

Preset은 메인 설정에 병합될 부분 설정입니다.

Preset을 작성할 때, 일반적으로 preset별 옵션을 요청할 수 있는 생성자 함수를 내보냅니다. 예를 들어:

ts
import { definePreset, Preset } from 'unocss'

export default definePreset((options?: MyPresetOptions) => {
  return {
    name: 'my-preset',
    rules: [
      // ...
    ],
    variants: [
      // ...
    ],
    // it supports most of the configuration you could have in the root config
  }
})

그러면 사용자는 다음과 같이 사용할 수 있습니다:

ts
import { defineConfig } from 'unocss'
import myPreset from './my-preset'

export default defineConfig({
  presets: [
    myPreset({ /* preset options */ }),
  ],
})

더 많은 예제는 공식 presets커뮤니티 presets를 확인하세요.

Released under the MIT License.