From b0550c271f8ac86f5f6d0d2f37c55ce907abf6c9 Mon Sep 17 00:00:00 2001 From: Gabriel Cipriano Date: Mon, 10 Apr 2023 14:21:42 -0300 Subject: [PATCH] docs: improve `publicAssets` config details (#1102) --- docs/content/3.config.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/content/3.config.md b/docs/content/3.config.md index dca44a2368..4d23befb3c 100644 --- a/docs/content/3.config.md +++ b/docs/content/3.config.md @@ -98,6 +98,22 @@ Public asset directories to serve in development and bundle in production. If a `public/` directory is detected, it will be added by default, but you can add more by yourself too! +It's possible to set Cache-Control headers for assets using the `maxAge` option: +``` + publicAssets: [ + { + baseURL: "images", + dir: "public/images", + maxAge: 60 * 60 * 24 * 7, // 7 days + }, + ], +``` +The config above generates the following header in the assets under `public/images/` folder: + +`cache-control: public, max-age=604800, immutable` + + + ### `compressPublicAssets` - Default: `{ gzip: false, brotli: false }`{lang=ts}