Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/aminya/astro-plugins

Various astro plugins such as astro-htmlnano to minify Astro files with HTMLNano and CSSNano
https://github.com/aminya/astro-plugins

astro astro-plugin cssnano html-minifier htmlnano minify optimize posthtml

Last synced: about 2 months ago
JSON representation

Various astro plugins such as astro-htmlnano to minify Astro files with HTMLNano and CSSNano

Awesome Lists containing this project

README

        

astro-htmlnano



Version

License: Apache--2.0

> Minify Astro files with HTMLNano and CSSNano

## Install

```sh
npm install --save astro-htmlnano
```

## Usage

### `getAstroHTMLNano` (function)

Minify Astro files with HTMLNano and CSSNano

**Parameters:**

- options (`HtmlnanoOptions`) - The HTMLNano options to use when transforming the HTML files
- preset (`HtmlnanoPreset`) - The HTMLNano preset to use

**returns:** (\_context: APIContext, Record>, next: MiddlewareNext) => Promise

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

```ts
import { getAstroHTMLNano } from "astro-htmlnano"

export const onRequest = getAstroHTMLNano()
```

astro-posthtml



Version

License: Apache--2.0

> Transform Astro files with PostHTML

## Install

```sh
npm install --save astro-posthtml
```

## Usage

### `getAstroPostHTML` (function)

Transform Astro files with PostHTML

**Parameters:**

- plugins (`Plugin[]`) - The posthtml plugins to use when transforming the HTML files
- options (`Options`) - The posthtml options

**returns:** (\_context: APIContext, Record>, next: MiddlewareNext) => Promise

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
```

## 🤝 Contributing

You can sponsor my work here:

https://github.com/sponsors/aminya

Pull requests, issues and feature requests are welcome.
See the [Contributing guide](https://github.com/aminya/atro-plugins/blob/master/CONTRIBUTING.md).