Replies: 1 comment
-
Hi @MrFoxPro, I think you're on the right track! You should be able to push that plug-in using an integration that provides the // astro.config.mjs
defineConfig({
integrations: [
{
name: 'my-cssnano-integration',
'astro:config:setup': ({
command,
updateConfig,
}) => {
if (command === 'build') {
updateConfig({
vite: {
plugins: [cssnano],
},
});
}
},
}
],
}); I'm not entirely sure how the cssnano plug-in is used but something like the above updated for how you pass cssnano to Vite might work! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm migrating from Vite, it has ability to export function from config with following arguments:
I want to push cssnano plugin to Vite config if command is 'build'. How can I achieve the same in Astro?
I see integration can access it, but
astro.config.mjs
disallows exporting function. Also, import.meta.env is irrelevant at config time.I'm using current workaround
const dev = process.env.npm_lifecycle_event === 'dev'
, as I don't want to mess with env variables and packages likecross-env
Beta Was this translation helpful? Give feedback.
All reactions