astro-posthtml
TypeScript icon, indicating that this package has built-in type declarations

1.1.2 • Public • Published

astro-posthtml

Version License: Apache--2.0

Transform Astro files with PostHTML

Install

npm install --save astro-posthtml

Usage

getAstroPostHTML (function)

Transform Astro files with PostHTML

Parameters:

  • plugins (Plugin<PostHTMLUseThis>[]) - The posthtml plugins to use when transforming the HTML files
  • options (Options) - The posthtml options

returns: (_context: APIContext<Record<string, any>, Record<string, string>>, next: MiddlewareNext) => Promise

Create ./src/middleware.ts with the following content:

import { getAstroPostHTML } from "astro-posthtml"
import htmlnano from "htmlnano"

export const onRequest = process.env.NODE_ENV === "production" ? getAstroPostHTML([htmlnano()]) : undefined

🤝 Contributing

You can sponsor my work here:

https://github.com/sponsors/aminya

Pull requests, issues and feature requests are welcome. See the Contributing guide.

/astro-posthtml/

    Package Sidebar

    Install

    npm i astro-posthtml

    Weekly Downloads

    10

    Version

    1.1.2

    License

    Apache-2.0

    Unpacked Size

    80.5 kB

    Total Files

    9

    Last publish

    Collaborators

    • aminya