From dce96612dfc5f08a9aed20029a5bdd7a0a8cd232 Mon Sep 17 00:00:00 2001 From: David Dal Busco Date: Thu, 14 Aug 2025 08:09:34 +0200 Subject: [PATCH 1/6] docs: replace gzip with precompress Signed-off-by: David Dal Busco --- docs/build/components/gzip.mdx | 35 -------------- docs/build/components/precompress.mdx | 66 +++++++++++++++++++++++++++ docs/build/hosting/configuration.mdx | 6 +-- docs/reference/configuration.mdx | 6 +-- 4 files changed, 72 insertions(+), 41 deletions(-) delete mode 100644 docs/build/components/gzip.mdx create mode 100644 docs/build/components/precompress.mdx diff --git a/docs/build/components/gzip.mdx b/docs/build/components/gzip.mdx deleted file mode 100644 index a215033f..00000000 --- a/docs/build/components/gzip.mdx +++ /dev/null @@ -1,35 +0,0 @@ -When deploying your application, the CLI automatically searches for JavaScript (js), ES Module (mjs), and CSS (css) files in the `source` folder and optimizes them using Gzip compression. This is useful because neither the protocol nor a satellite can compress these files, ensuring the best web performance. - -If you wish to customize this behavior, you have the option to disable it or provide a different file matching pattern using glob syntax. - -To opt-out of Gzip compression, simply set the `gzip` option to `false` in your configuration: - -```javascript title="juno.config.js" -import { defineConfig } from "@junobuild/config"; - -export default defineConfig({ - satellite: { - ids: { - production: "qsgjb-riaaa-aaaaa-aaaga-cai" - }, - source: "dist", - gzip: false - } -}); -``` - -If you want to customize the default pattern `**/*.+(css|js|mjs|html)` to better suit your needs, you can specify your own pattern. For example: - -```javascript title="juno.config.js" -import { defineConfig } from "@junobuild/config"; - -export default defineConfig({ - satellite: { - ids: { - production: "qsgjb-riaaa-aaaaa-aaaga-cai" - }, - source: "dist", - gzip: "**/*.jpg" - } -}); -``` diff --git a/docs/build/components/precompress.mdx b/docs/build/components/precompress.mdx new file mode 100644 index 00000000..06a9ef17 --- /dev/null +++ b/docs/build/components/precompress.mdx @@ -0,0 +1,66 @@ +When deploying your application, the CLI automatically searches for JavaScript (js), ES Module (mjs), CSS (css) and HTML (html) files in the `source` folder to optimize them using Gzip compression. This improves the performance of your app when it is served on the web. + +By default, precompression stores **both** the original and compressed versions in Storage. + +You can disable it entirely or customize which files are precompressed, whether to keep originals, and which compression algorithm to use. + +## Disable precompression + +Set the `precompress` option to `false` in your configuration: + +```javascript title="juno.config.js" +import { defineConfig } from "@junobuild/config"; + +export default defineConfig({ + satellite: { + ids: { + production: "qsgjb-riaaa-aaaaa-aaaga-cai" + }, + source: "dist", + precompress: false + } +}); +``` + +## Customize the file matching pattern + +If you want to customize the default pattern `**/*.+(css|js|mjs|html)` to better suit your needs, you can specify your own pattern. For example: + +```javascript title="juno.config.js" +import { defineConfig } from "@junobuild/config"; + +export default defineConfig({ + satellite: { + ids: { + production: "qsgjb-riaaa-aaaaa-aaaga-cai" + }, + source: "dist", + precompress: { + pattern: "**/*.jpg" // precompress JPEG files only + } + } +}); +``` + +## Decide what happens to original files + +The `mode` option controls what happens to the original files after compression: + +- `"both"` — upload both the original and the compressed version. _(default)_ +- `"replace"` — upload only the compressed version and serve it with the appropriate `Content-Encoding` header. + +```javascript title="juno.config.js" +import { defineConfig } from "@junobuild/config"; + +export default defineConfig({ + satellite: { + ids: { + production: "qsgjb-riaaa-aaaaa-aaaga-cai" + }, + source: "dist", + precompress: { + mode: "replace" + } + } +}); +``` diff --git a/docs/build/hosting/configuration.mdx b/docs/build/hosting/configuration.mdx index b46e7d4d..df2dda8a 100644 --- a/docs/build/hosting/configuration.mdx +++ b/docs/build/hosting/configuration.mdx @@ -8,7 +8,7 @@ You can customize your hosting environment to fit your needs, including: - Serve a customized 404 page. [Learn how.](#customize-a-404not-found-page) - Set up `redirects` for pages that you've moved or deleted. [Learn how.](#redirects) - Set up `rewrites`. [Learn how.](#rewrites) -- Tweak `gzip` compression for best performance. [Learn how.](#gzip) +- Customize file `compression` for optimal performance. [Learn how.](#precompress) - Customize the `encoding` behavior of your files. [Learn how.](#encoding-types) - Allow your project to be embedded as an `iframe`. [Learn how.](#iframe) - Customize `assertions` to modify the default verification behavior of the CLI. [Learn how.](#assertions) @@ -69,9 +69,9 @@ import Rewrites from "../components/rewrites.mdx"; ### GZIP -import Gzip from "../components/gzip.mdx"; +import Precompress from "../components/precompress.mdx"; - + ### Encoding types diff --git a/docs/reference/configuration.mdx b/docs/reference/configuration.mdx index 9d70ff3f..cc874b13 100644 --- a/docs/reference/configuration.mdx +++ b/docs/reference/configuration.mdx @@ -73,11 +73,11 @@ import IgnoreFiles from "../build/components/ignore-files.mdx"; -### GZIP +### Precompress -import Gzip from "../build/components/gzip.mdx"; +import Precompress from "../build/components/precompress.mdx"; - + ### Encoding From e7e389301e80558410a3f54f82acad55ada86564 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 14 Aug 2025 06:11:08 +0000 Subject: [PATCH 2/6] =?UTF-8?q?=F0=9F=93=84=20Update=20LLMs.txt=20snapshot?= =?UTF-8?q?=20for=20PR=20review?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .llms-snapshots/llms-full.txt | 62 ++++++++++++++++++++++++++++------- 1 file changed, 50 insertions(+), 12 deletions(-) diff --git a/.llms-snapshots/llms-full.txt b/.llms-snapshots/llms-full.txt index 27333f40..52f74351 100644 --- a/.llms-snapshots/llms-full.txt +++ b/.llms-snapshots/llms-full.txt @@ -1675,7 +1675,7 @@ You can customize your hosting environment to fit your needs, including: * Serve a customized 404 page. ([Learn how.](#customize-a-404not-found-page)) * Set up `redirects` for pages that you've moved or deleted. ([Learn how.](#redirects)) * Set up `rewrites`. ([Learn how.](#rewrites)) -* Tweak `gzip` compression for best performance. ([Learn how.](#gzip)) +* Customize file `compression` for optimal performance. ([Learn how.](#precompress)) * Customize the `encoding` behavior of your files. ([Learn how.](#encoding-types)) * Allow your project to be embedded as an `iframe`. ([Learn how.](#iframe)) * Customize `assertions` to modify the default verification behavior of the CLI. ([Learn how.](#assertions)) @@ -1804,24 +1804,43 @@ This `source` attribute works similarly to Git's `.gitignore`, and you can speci ### GZIP -When deploying your application, the CLI automatically searches for JavaScript (js), ES Module (mjs), and CSS (css) files in the `source` folder and optimizes them using Gzip compression. This is useful because neither the protocol nor a satellite can compress these files, ensuring the best web performance. +When deploying your application, the CLI automatically searches for JavaScript (js), ES Module (mjs), CSS (css) and HTML (html) files in the `source` folder to optimize them using Gzip compression. This improves the performance of your app when it is served on the web. -If you wish to customize this behavior, you have the option to disable it or provide a different file matching pattern using glob syntax. +By default, precompression stores **both** the original and compressed versions in Storage. -To opt-out of Gzip compression, simply set the `gzip` option to `false` in your configuration: +You can disable it entirely or customize which files are precompressed, whether to keep originals, and which compression algorithm to use. + +## Disable precompression + +Set the `precompress` option to `false` in your configuration: juno.config.js ``` -import { defineConfig } from "@junobuild/config";export default defineConfig({ satellite: { ids: { production: "qsgjb-riaaa-aaaaa-aaaga-cai" }, source: "dist", gzip: false }}); +import { defineConfig } from "@junobuild/config";export default defineConfig({ satellite: { ids: { production: "qsgjb-riaaa-aaaaa-aaaga-cai" }, source: "dist", precompress: false }}); ``` +## Customize the file matching pattern + If you want to customize the default pattern `**/*.+(css|js|mjs|html)` to better suit your needs, you can specify your own pattern. For example: juno.config.js ``` -import { defineConfig } from "@junobuild/config";export default defineConfig({ satellite: { ids: { production: "qsgjb-riaaa-aaaaa-aaaga-cai" }, source: "dist", gzip: "**/*.jpg" }}); +import { defineConfig } from "@junobuild/config";export default defineConfig({ satellite: { ids: { production: "qsgjb-riaaa-aaaaa-aaaga-cai" }, source: "dist", precompress: { pattern: "**/*.jpg" // precompress JPEG files only } }}); +``` + +## Decide what happens to original files + +The `mode` option controls what happens to the original files after compression: + +* `"both"` — upload both the original and the compressed version. _(default)_ +* `"replace"` — upload only the compressed version and serve it with the appropriate `Content-Encoding` header. + +juno.config.js + +``` +import { defineConfig } from "@junobuild/config";export default defineConfig({ satellite: { ids: { production: "qsgjb-riaaa-aaaaa-aaaga-cai" }, source: "dist", precompress: { mode: "replace" } }}); ``` ### Encoding types @@ -7858,26 +7877,45 @@ juno.config.js import { defineConfig } from "@junobuild/config";export default defineConfig({ satellite: { ids: { production: "qsgjb-riaaa-aaaaa-aaaga-cai" }, source: "dist", ignore: ["**/*.txt", ".tmp/"] }}); ``` -### GZIP +### Precompress -When deploying your application, the CLI automatically searches for JavaScript (js), ES Module (mjs), and CSS (css) files in the `source` folder and optimizes them using Gzip compression. This is useful because neither the protocol nor a satellite can compress these files, ensuring the best web performance. +When deploying your application, the CLI automatically searches for JavaScript (js), ES Module (mjs), CSS (css) and HTML (html) files in the `source` folder to optimize them using Gzip compression. This improves the performance of your app when it is served on the web. -If you wish to customize this behavior, you have the option to disable it or provide a different file matching pattern using glob syntax. +By default, precompression stores **both** the original and compressed versions in Storage. -To opt-out of Gzip compression, simply set the `gzip` option to `false` in your configuration: +You can disable it entirely or customize which files are precompressed, whether to keep originals, and which compression algorithm to use. + +## Disable precompression + +Set the `precompress` option to `false` in your configuration: juno.config.js ``` -import { defineConfig } from "@junobuild/config";export default defineConfig({ satellite: { ids: { production: "qsgjb-riaaa-aaaaa-aaaga-cai" }, source: "dist", gzip: false }}); +import { defineConfig } from "@junobuild/config";export default defineConfig({ satellite: { ids: { production: "qsgjb-riaaa-aaaaa-aaaga-cai" }, source: "dist", precompress: false }}); ``` +## Customize the file matching pattern + If you want to customize the default pattern `**/*.+(css|js|mjs|html)` to better suit your needs, you can specify your own pattern. For example: juno.config.js ``` -import { defineConfig } from "@junobuild/config";export default defineConfig({ satellite: { ids: { production: "qsgjb-riaaa-aaaaa-aaaga-cai" }, source: "dist", gzip: "**/*.jpg" }}); +import { defineConfig } from "@junobuild/config";export default defineConfig({ satellite: { ids: { production: "qsgjb-riaaa-aaaaa-aaaga-cai" }, source: "dist", precompress: { pattern: "**/*.jpg" // precompress JPEG files only } }}); +``` + +## Decide what happens to original files + +The `mode` option controls what happens to the original files after compression: + +* `"both"` — upload both the original and the compressed version. _(default)_ +* `"replace"` — upload only the compressed version and serve it with the appropriate `Content-Encoding` header. + +juno.config.js + +``` +import { defineConfig } from "@junobuild/config";export default defineConfig({ satellite: { ids: { production: "qsgjb-riaaa-aaaaa-aaaga-cai" }, source: "dist", precompress: { mode: "replace" } }}); ``` ### Encoding From d5e28a92ad5474fa3b06fd5f7ef2c08d8ebee535 Mon Sep 17 00:00:00 2001 From: David Dal Busco Date: Thu, 14 Aug 2025 13:52:19 +0200 Subject: [PATCH 3/6] docs: brotli Signed-off-by: David Dal Busco --- docs/build/components/precompress.mdx | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/docs/build/components/precompress.mdx b/docs/build/components/precompress.mdx index 06a9ef17..55021fe0 100644 --- a/docs/build/components/precompress.mdx +++ b/docs/build/components/precompress.mdx @@ -64,3 +64,25 @@ export default defineConfig({ } }); ``` + +## Choose the compression algorithm + +By default, precompression uses **Gzip** (`algorithm: "gzip"`) because it offers a good balance between compression speed, compatibility, and size. + +You can switch to **Brotli** (`algorithm: "brotli"`) for potentially smaller files, especially for text-based assets such as those compressed by default like HTML, CSS, and JavaScript. + +```javascript title="juno.config.js" +import { defineConfig } from "@junobuild/config"; + +export default defineConfig({ + satellite: { + ids: { + production: "qsgjb-riaaa-aaaaa-aaaga-cai" + }, + source: "dist", + precompress: { + algorithm: "brotli" + } + } +}); +``` From 8269944f5774032589f565fa1afe872008b73c71 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 14 Aug 2025 11:54:04 +0000 Subject: [PATCH 4/6] =?UTF-8?q?=F0=9F=93=84=20Update=20LLMs.txt=20snapshot?= =?UTF-8?q?=20for=20PR=20review?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .llms-snapshots/llms-full.txt | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.llms-snapshots/llms-full.txt b/.llms-snapshots/llms-full.txt index 52f74351..92e9f2e4 100644 --- a/.llms-snapshots/llms-full.txt +++ b/.llms-snapshots/llms-full.txt @@ -1843,6 +1843,18 @@ juno.config.js import { defineConfig } from "@junobuild/config";export default defineConfig({ satellite: { ids: { production: "qsgjb-riaaa-aaaaa-aaaga-cai" }, source: "dist", precompress: { mode: "replace" } }}); ``` +## Choose the compression algorithm + +By default, precompression uses **Gzip** (`algorithm: "gzip"`) because it offers a good balance between compression speed, compatibility, and size. + +You can switch to **Brotli** (`algorithm: "brotli"`) for potentially smaller files, especially for text-based assets such as those compressed by default like HTML, CSS, and JavaScript. + +juno.config.js + +``` +import { defineConfig } from "@junobuild/config";export default defineConfig({ satellite: { ids: { production: "qsgjb-riaaa-aaaaa-aaaga-cai" }, source: "dist", precompress: { algorithm: "brotli" } }}); +``` + ### Encoding types When deploying, the CLI automatically maps the encoding type based on the file extension. The encoding information is then used in the satellite to provide the appropriate HTTP response header `Content-Encoding`. @@ -7918,6 +7930,18 @@ juno.config.js import { defineConfig } from "@junobuild/config";export default defineConfig({ satellite: { ids: { production: "qsgjb-riaaa-aaaaa-aaaga-cai" }, source: "dist", precompress: { mode: "replace" } }}); ``` +## Choose the compression algorithm + +By default, precompression uses **Gzip** (`algorithm: "gzip"`) because it offers a good balance between compression speed, compatibility, and size. + +You can switch to **Brotli** (`algorithm: "brotli"`) for potentially smaller files, especially for text-based assets such as those compressed by default like HTML, CSS, and JavaScript. + +juno.config.js + +``` +import { defineConfig } from "@junobuild/config";export default defineConfig({ satellite: { ids: { production: "qsgjb-riaaa-aaaaa-aaaga-cai" }, source: "dist", precompress: { algorithm: "brotli" } }}); +``` + ### Encoding When deploying, the CLI automatically maps the encoding type based on the file extension. The encoding information is then used in the satellite to provide the appropriate HTTP response header `Content-Encoding`. From 9e844a1c8221a793b4668316c8c11d8b7ca1cc0b Mon Sep 17 00:00:00 2001 From: David Dal Busco Date: Thu, 14 Aug 2025 14:00:39 +0200 Subject: [PATCH 5/6] docs: note Signed-off-by: David Dal Busco --- docs/build/components/precompress.mdx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/build/components/precompress.mdx b/docs/build/components/precompress.mdx index 55021fe0..09c57cc1 100644 --- a/docs/build/components/precompress.mdx +++ b/docs/build/components/precompress.mdx @@ -4,6 +4,12 @@ By default, precompression stores **both** the original and compressed versions You can disable it entirely or customize which files are precompressed, whether to keep originals, and which compression algorithm to use. +:::note + +If you change the precompress configuration and your project has already been deployed, run `juno clear` before redeploying to ensure you change is applied. + +::: + ## Disable precompression Set the `precompress` option to `false` in your configuration: From d6a8e5824d387a29fc93b307246f797e45954c80 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 14 Aug 2025 12:02:24 +0000 Subject: [PATCH 6/6] =?UTF-8?q?=F0=9F=93=84=20Update=20LLMs.txt=20snapshot?= =?UTF-8?q?=20for=20PR=20review?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .llms-snapshots/llms-full.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.llms-snapshots/llms-full.txt b/.llms-snapshots/llms-full.txt index 92e9f2e4..19c41de1 100644 --- a/.llms-snapshots/llms-full.txt +++ b/.llms-snapshots/llms-full.txt @@ -1810,6 +1810,10 @@ By default, precompression stores **both** the original and compressed versions You can disable it entirely or customize which files are precompressed, whether to keep originals, and which compression algorithm to use. +**Note:** + +If you change the precompress configuration and your project has already been deployed, run `juno clear` before redeploying to ensure you change is applied. + ## Disable precompression Set the `precompress` option to `false` in your configuration: @@ -7897,6 +7901,10 @@ By default, precompression stores **both** the original and compressed versions You can disable it entirely or customize which files are precompressed, whether to keep originals, and which compression algorithm to use. +**Note:** + +If you change the precompress configuration and your project has already been deployed, run `juno clear` before redeploying to ensure you change is applied. + ## Disable precompression Set the `precompress` option to `false` in your configuration: