🗜️ [AstroCompress] This [Astro integration][astro-integration] brings compression utilities to your Astro project. [CSS][csso] / [HTML][html-minifier-terser] / [JavaScript][terser] / [Image][sharp] / [SVG][svgo] Note AstroCompress will not compress your requests, only your statically generated build and pre-rendered routes. [!IMPORTANT] Use AstroCompress last in your integration list for the best optimization…
You can also provide a map of paths for different input output directories.
astro.config.ts
import Compress from "astro-compress";
export default {
integrations: [
Compress({
Path: new Map([["./Source", "./Target"]]),
}),
],
};
Or an array of the two.
astro.config.ts
import Compress from "astro-compress";
export default {
integrations: [
Compress({
Path: [
// Compress Target
"./Target",
// Compress Target one more time into a different directory
new Map([["./Target", "./TargetCompress"]]),
],
}),
],
};
File Filtering
You can filter files to exclude specific ones from compression. A filter can be
an array of regular expressions or a single match. You can also use functions to
match on file names:
You can control the logging level by setting the Logger parameter. The default
value is 2, but you can set it to 0 if you don’t want to see debug messages:
评论