Skip to content

प्रीसेट्स

प्रीसेट्स आंशिक कॉन्फ़िगरेशन हैं जो मुख्य कॉन्फ़िगरेशन में मर्ज किए जाएंगे।

एक प्रीसेट लिखते समय, हम आमतौर पर एक कंस्ट्रक्टर फ़ंक्शन निर्यात करते हैं जहाँ आप कुछ प्रीसेट-विशिष्ट विकल्पों के लिए पूछ सकते हैं। उदाहरण के लिए:

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 */ }),
  ],
})

आप अधिक उदाहरणों के लिए आधिकारिक प्रीसेट्स और सामुदायिक प्रीसेट्स देख सकते हैं।

Released under the MIT License.