Skip to content

Commit

Permalink
feat: add autoImports option
Browse files Browse the repository at this point in the history
  • Loading branch information
wattanx committed Jan 25, 2024
1 parent 89cc5fc commit 672a4e1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export default defineNuxtModule<ModuleOptions>({
outdir: "styled-system",
cwd: nuxt.options.buildDir,
cssPath: `${nuxt.options.buildDir}/panda.css`,
autoImports: true,
}),
async setup(options, nuxt) {
const { resolve } = createResolver(import.meta.url);
Expand All @@ -43,7 +44,9 @@ export default defineNuxtModule<ModuleOptions>({
"./*"
);

addImportsSources(createPresets({ outdir: options.outdir }));
if (options.autoImports) {
addImportsSources(createPresets({ outdir: options.outdir }));
}

if (existsSync(resolve(nuxt.options.buildDir, "panda.config.mjs"))) {
await fsp.rm(resolve(nuxt.options.buildDir, "panda.config.mjs"));
Expand Down
5 changes: 5 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,9 @@ export interface ModuleOptions extends Config {
* @example '@/assets/css/global.css'
*/
cssPath?: string;
/**
* Automatically add to the auto imports.
* @default true
*/
autoImports?: boolean;
}

0 comments on commit 672a4e1

Please sign in to comment.