@pandabox/panda-plugins
Version:
- `missing-css-warnings` - Logs a warning message when a CSS rule was used at runtime but couldn't be statically extracted - `strict-tokens-scope` - Enforce `strictTokens` only for a set of `TokenCategory` or style props - `strict-tokens-runtime` - Enfo
37 lines (34 loc) • 1.23 kB
text/typescript
import type { PandaPlugin } from '@pandacss/types'
import { transformFeatures, type RemoveFeaturesOptions } from './remove-features'
/**
* Enables a minimal setup for Panda CSS.
* @see https://panda-css.com/docs/guides/minimal-setup
*
* - Removes the `@pandacss/preset-base` preset with `eject: true`
* @see https://panda-css.com/docs/references/config#eject
*
* - Removes the built-in `@pandacss/preset-panda` by setting `presets: []` if not defined
* @see https://panda-css.com/docs/customization/presets#which-panda-presets-will-be-included-
*
* - Allows removing features from the `styled-system` generated folder
*
*/
export const pluginMinimalSetup = (options: RemoveFeaturesOptions): PandaPlugin => {
return {
name: 'minimal-setup',
hooks: {
'config:resolved': (args) => {
// Eject `@pandacss/preset-base`
args.config.eject = true
// If the user has not defined presets, we need to define it as an empty array
// to remove the built-in `@pandacss/preset-panda`
if (!args.config.presets) {
args.config.presets = []
}
},
'codegen:prepare': (args) => {
return transformFeatures(args, options)
},
},
}
}