gzip for astro static sites https://zokki.net
Go to file
2024-04-15 23:15:57 +02:00
.vscode v1.0.0 2024-04-13 16:58:22 +02:00
src fix: loggin name 2024-04-13 17:28:39 +02:00
.gitignore v1.0.0 2024-04-13 16:58:22 +02:00
.npmignore v1.0.0 2024-04-13 16:58:22 +02:00
.prettierrc v1.0.0 2024-04-13 16:58:22 +02:00
LICENSE v1.0.0 2024-04-13 16:58:22 +02:00
package-lock.json v1.0.3 2024-04-15 23:15:57 +02:00
package.json v1.0.3 2024-04-15 23:15:57 +02:00
README.md fix: tsdoc for logAllFiles 2024-04-13 17:28:15 +02:00
tsconfig.json v1.0.0 2024-04-13 16:58:22 +02:00

@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