Skip to content

Commit

Permalink
feat(unplugin): allow configuration of codegen (#70)
Browse files Browse the repository at this point in the history
Fixes #68
  • Loading branch information
cgatian authored Feb 3, 2025
1 parent 14bf460 commit e465bb3
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/unplugin/src/plugin/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ export interface PandaPluginOptions extends Partial<PandaPluginHooks>, Pick<Tran
* Will remove unused CSS variables and keyframes from the generated CSS
*/
optimizeCss?: boolean

/**
* Generate a styled-system folder on server start.
*
* @default true
*/
codeGen?: boolean
}

interface SourceFileHookArgs {
Expand Down Expand Up @@ -235,7 +242,9 @@ export const unpluginFactory: UnpluginFactory<PandaPluginOptions | undefined> =
}

// (re) generate the `styled-system` (outdir) on server (re)start
const { msg } = await codegen(ctx.panda)
if (options.codeGen) {
const { msg } = await codegen(ctx.panda)
}
// console.log(options)
// console.log(ctx.panda.paths.root, ctx.panda.config.cwd)
// console.log('codegen done', msg)
Expand Down Expand Up @@ -307,5 +316,6 @@ const resolveOptions = (options: PandaPluginOptions): RequiredBy<PandaPluginOpti
exclude: options.exclude || [/node_modules/, /styled-system/],
optimizeCss: options.optimizeCss ?? true,
optimizeJs: options.optimizeJs ?? 'macro',
codeGen: options.codeGen ?? true,
}
}

0 comments on commit e465bb3

Please sign in to comment.