Astro Config
3 min read
Vite rollupOptions
Sets the filename ex: /dist/_astro/main.css
import { defineConfig } from 'astro/config';
export default defineConfig({
output: "static",
vite: {
build: {
rollupOptions: {
output: {
assetFileNames: "_astro/main[extname]",
},
},
},
},
});File + Extension Name Variables
[extname]: file extension that includes the.css.[ext]: file extensioncss.[hash]: random hash added to filenamemain-[hash].[name]: name is based on filename, it comes up asaboutfor me.
External CSS
I haven’t tried this yet, but it’s here to remind me.
import { defineConfig } from 'astro/config';
export default defineConfig({
build: {
inlineStylesheets: 'never'
}
});Redirects
Important for pagination.
Going from wordpress that only adds /page/2 when $paged!==1. Where Astro starts with /page, but not /page/1.
export default defineConfig({
redirects: {
"/blog": "/blog/page",
"/blog/page/1": "/blog/page"
"/from-this": "/to-this"
}
});You can also redirect with a Redirection Layout.