@zokki/astro-brotli
Version:
brotli compression for astro static sites
51 lines (38 loc) • 962 B
Markdown
This integration finds files matching the specified extensions within the Astro build output directory and compresses them using brotli.
> **Note**
>
> `astro-brotli` only for statically generated build and pre-rendered routes.
1. Install with npm.
```bash
npm install @zokki/astro-brotli
```
2. Import into the astro-config. The integration should be the last one in the array.
```ts
import { brotli } from '@zokki/astro-brotli';
export default defineConfig({
integrations: [brotli()],
});
```
```ts
/**
* Toggle logging of all compressed files
*
* @default true
*/
logAllFiles?: boolean;
/**
* Which extension should be compressed
*
* @default ['css', 'js', 'html', 'xml', 'cjs', 'mjs', 'svg', 'txt']
*/
extensions?: string[];
/**
* Options for brotli compression
*/
brotliOptions?: BrotliOptions;
```
[](LICENSE) © Tim-Niclas Oelschläger