Compress

screenshot of Compress
astro

Compress

Overview:

AstroCompress is an Astro integration that brings compression utilities to your Astro project. It allows for the compression of CSS, HTML, JavaScript, images, and SVG files in the Astro outDir folder. It is important to note that AstroCompress will only compress the statically generated build and pre-rendered routes, not requests. To achieve the best optimization, AstroCompress should be used as the last integration in the integration list.

Features:

  • Compression of CSS, HTML, SVG, JavaScript, and image files in the Astro outDir folder.
  • Support for compressing image files types such as avci, avcs, avif, avifs, gif, heic, heics, heif, heifs, jfif, jif, jpeg, jpg, apng, png, raw, tiff, and webp via sharp.
  • Support for SVG compression via svgo.
  • Customization options to override default compression options from configurations of csso, html-minifier-terser, sharp, svgo, terser, and more.
  • Ability to add multiple paths for compression by specifying an array of paths.
  • Input-Output mapping to provide a map of paths for different input and output directories.
  • File filtering options to exclude specific files from compression.
  • Logging control to set the logging level and enable/disable debug messages.

Option 1: Using astro add command

astro
Astro

Astro is the all-in-one web framework designed for speed. Pull your content from anywhere and deploy everywhere, all powered by your favorite UI components and libraries.