astro-gzip/README.md

959 B

@zokki/astro-gzip

This integration finds files matching the specified extensions within the Astro build output directory and compresses them using GZip.

Note

astro-gzip only for statically generated build and pre-rendered routes.

Installation

  1. Install with npm.

    npm install @zokki/astro-gzip
    
  2. Import into the astro-config. The integration should be the last one in the array.

    import { gzip } from '@zokki/astro-gzip';
    
    export default defineConfig({
    	integrations: [gzip()],
    });
    

Configuration

/**
 * Toggle logging of all gzipped files
 *
 * @default true
 */
logAllFiles?: boolean;
/**
 * Which extension should be gzipped
 *
 * @default ['css', 'js', 'html', 'xml', 'cjs', 'mjs', 'svg', 'txt']
 */
extensions?: string[];
/**
 * Options for the zipping
 *
 * @default { level: 9 }
 */
zlibOptions?: ZlibOptions;

License

MIT © Tim-Niclas Oelschläger