@northstarthemes/astro-set-prerender
v0.0.2
Published
Prerender plugin for Astro by North Star Themes
Readme
AstroJS Prerender Plugin
A plugin by North Star Themes that gives you control over which routes should be static rendered (prerendered) and which should be server rendered in your Astro application.
Installation
npm install @northstarthemes/astro-set-prerenderUsage
Add the plugin to your astro.config.mjs:
import { defineConfig } from 'astro/config'
import setPrerender from '@northstarthemes/astro-set-prerender'
export default defineConfig({
integrations: [
setPrerender({
// Configuration options here
}),
],
})Configuration
The plugin accepts the following configuration options:
setPrerender({
// Array of route patterns that should be prerendered
prerenderRoutes: [/^\/blog\/.*$/, /^\/about\//],
// Array of route patterns that should be server rendered
serverRoutes: [/^\/api\/.*$/],
})Only one of the two configuration options can be defined. If prerenderRoutes is defined, then all other routes are server rendered by default. If serverRoutes is defined then all other routes are static rendered by default. This plugin will not override any files that explicitly set prerender behavior
Features
- Support for regex patterns in route definitions
- Easy integration with existing Astro projects
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT License - see the LICENSE file for details.
Support
For support, please visit North Star Themes or open an issue on GitHub.
