Transform Astro files with PostHTML
npm install astro-posthtml> Transform Astro files with PostHTML
``sh`
npm install --save astro-posthtml
Transform Astro files with PostHTML
Parameters:
- plugins (Plugin) - The posthtml plugins to use when transforming the HTML filesOptions
- options () - The posthtml options
returns: (\_context: APIContext
Create ./src/middleware.ts with the following content:
`ts
import { getAstroPostHTML } from "astro-posthtml"
import htmlnano from "htmlnano"
export const onRequest = process.env.NODE_ENV === "production" ? getAstroPostHTML([htmlnano()]) : undefined
``
You can sponsor my work here:
https://github.com/sponsors/aminya
Pull requests, issues and feature requests are welcome.
See the Contributing guide.