Skip to content

Commit

Permalink
feat(astro): introduce the injectExtra option (#1878)
Browse files Browse the repository at this point in the history
  • Loading branch information
equt committed Nov 18, 2022
1 parent fac166f commit f2fda68
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/astro/src/index.ts
Expand Up @@ -16,6 +16,12 @@ export interface AstroIntegrationConfig<Theme extends {} = {}> extends VitePlugi
* @default true
*/
injectEntry?: boolean | string

/**
* Inject extra imports for every astro page
* @default []
*/
injectExtra?: string[]
}

export default function UnoCSSAstroIntegration<Theme extends {}>(
Expand All @@ -25,6 +31,7 @@ export default function UnoCSSAstroIntegration<Theme extends {}>(
const {
injectEntry = true,
injectReset: includeReset = true,
injectExtra = [],
} = options

return {
Expand All @@ -46,6 +53,8 @@ export default function UnoCSSAstroIntegration<Theme extends {}>(
? injectEntry
: 'import "uno.css"')
}
if (injectExtra.length > 0)
injects.push(...injectExtra)
if (injects?.length)
injectScript('page-ssr', injects.join('\n'))
},
Expand Down

0 comments on commit f2fda68

Please sign in to comment.