Skip to content

Commit ad8ee70

Browse files
docs: replace gzip with precompress (#498)
* docs: replace gzip with precompress Signed-off-by: David Dal Busco <david.dalbusco@outlook.com> * 📄 Update LLMs.txt snapshot for PR review * docs: brotli Signed-off-by: David Dal Busco <david.dalbusco@outlook.com> * 📄 Update LLMs.txt snapshot for PR review * docs: note Signed-off-by: David Dal Busco <david.dalbusco@outlook.com> * 📄 Update LLMs.txt snapshot for PR review --------- Signed-off-by: David Dal Busco <david.dalbusco@outlook.com> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 287d6e6 commit ad8ee70

5 files changed

Lines changed: 182 additions & 53 deletions

File tree

.llms-snapshots/llms-full.txt

Lines changed: 82 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1675,7 +1675,7 @@ You can customize your hosting environment to fit your needs, including:
16751675
* Serve a customized 404 page. ([Learn how.](#customize-a-404not-found-page))
16761676
* Set up `redirects` for pages that you've moved or deleted. ([Learn how.](#redirects))
16771677
* Set up `rewrites`. ([Learn how.](#rewrites))
1678-
* Tweak `gzip` compression for best performance. ([Learn how.](#gzip))
1678+
* Customize file `compression` for optimal performance. ([Learn how.](#precompress))
16791679
* Customize the `encoding` behavior of your files. ([Learn how.](#encoding-types))
16801680
* Allow your project to be embedded as an `iframe`. ([Learn how.](#iframe))
16811681
* Customize `assertions` to modify the default verification behavior of the CLI. ([Learn how.](#assertions))
@@ -1804,24 +1804,59 @@ This `source` attribute works similarly to Git's `.gitignore`, and you can speci
18041804

18051805
### GZIP
18061806

1807-
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.
1807+
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.
18081808

1809-
If you wish to customize this behavior, you have the option to disable it or provide a different file matching pattern using glob syntax.
1809+
By default, precompression stores **both** the original and compressed versions in Storage.
18101810

1811-
To opt-out of Gzip compression, simply set the `gzip` option to `false` in your configuration:
1811+
You can disable it entirely or customize which files are precompressed, whether to keep originals, and which compression algorithm to use.
1812+
1813+
**Note:**
1814+
1815+
If you change the precompress configuration and your project has already been deployed, run `juno clear` before redeploying to ensure you change is applied.
1816+
1817+
## Disable precompression
1818+
1819+
Set the `precompress` option to `false` in your configuration:
18121820

18131821
juno.config.js
18141822

18151823
```
1816-
import { defineConfig } from "@junobuild/config";export default defineConfig({ satellite: { ids: { production: "qsgjb-riaaa-aaaaa-aaaga-cai" }, source: "dist", gzip: false }});
1824+
import { defineConfig } from "@junobuild/config";export default defineConfig({ satellite: { ids: { production: "qsgjb-riaaa-aaaaa-aaaga-cai" }, source: "dist", precompress: false }});
18171825
```
18181826

1827+
## Customize the file matching pattern
1828+
18191829
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:
18201830

18211831
juno.config.js
18221832

18231833
```
1824-
import { defineConfig } from "@junobuild/config";export default defineConfig({ satellite: { ids: { production: "qsgjb-riaaa-aaaaa-aaaga-cai" }, source: "dist", gzip: "**/*.jpg" }});
1834+
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 } }});
1835+
```
1836+
1837+
## Decide what happens to original files
1838+
1839+
The `mode` option controls what happens to the original files after compression:
1840+
1841+
* `"both"` — upload both the original and the compressed version. _(default)_
1842+
* `"replace"` — upload only the compressed version and serve it with the appropriate `Content-Encoding` header.
1843+
1844+
juno.config.js
1845+
1846+
```
1847+
import { defineConfig } from "@junobuild/config";export default defineConfig({ satellite: { ids: { production: "qsgjb-riaaa-aaaaa-aaaga-cai" }, source: "dist", precompress: { mode: "replace" } }});
1848+
```
1849+
1850+
## Choose the compression algorithm
1851+
1852+
By default, precompression uses **Gzip** (`algorithm: "gzip"`) because it offers a good balance between compression speed, compatibility, and size.
1853+
1854+
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.
1855+
1856+
juno.config.js
1857+
1858+
```
1859+
import { defineConfig } from "@junobuild/config";export default defineConfig({ satellite: { ids: { production: "qsgjb-riaaa-aaaaa-aaaga-cai" }, source: "dist", precompress: { algorithm: "brotli" } }});
18251860
```
18261861

18271862
### Encoding types
@@ -7858,26 +7893,61 @@ juno.config.js
78587893
import { defineConfig } from "@junobuild/config";export default defineConfig({ satellite: { ids: { production: "qsgjb-riaaa-aaaaa-aaaga-cai" }, source: "dist", ignore: ["**/*.txt", ".tmp/"] }});
78597894
```
78607895

7861-
### GZIP
7896+
### Precompress
78627897

7863-
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.
7898+
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.
78647899

7865-
If you wish to customize this behavior, you have the option to disable it or provide a different file matching pattern using glob syntax.
7900+
By default, precompression stores **both** the original and compressed versions in Storage.
78667901

7867-
To opt-out of Gzip compression, simply set the `gzip` option to `false` in your configuration:
7902+
You can disable it entirely or customize which files are precompressed, whether to keep originals, and which compression algorithm to use.
7903+
7904+
**Note:**
7905+
7906+
If you change the precompress configuration and your project has already been deployed, run `juno clear` before redeploying to ensure you change is applied.
7907+
7908+
## Disable precompression
7909+
7910+
Set the `precompress` option to `false` in your configuration:
78687911

78697912
juno.config.js
78707913

78717914
```
7872-
import { defineConfig } from "@junobuild/config";export default defineConfig({ satellite: { ids: { production: "qsgjb-riaaa-aaaaa-aaaga-cai" }, source: "dist", gzip: false }});
7915+
import { defineConfig } from "@junobuild/config";export default defineConfig({ satellite: { ids: { production: "qsgjb-riaaa-aaaaa-aaaga-cai" }, source: "dist", precompress: false }});
78737916
```
78747917

7918+
## Customize the file matching pattern
7919+
78757920
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:
78767921

78777922
juno.config.js
78787923

78797924
```
7880-
import { defineConfig } from "@junobuild/config";export default defineConfig({ satellite: { ids: { production: "qsgjb-riaaa-aaaaa-aaaga-cai" }, source: "dist", gzip: "**/*.jpg" }});
7925+
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 } }});
7926+
```
7927+
7928+
## Decide what happens to original files
7929+
7930+
The `mode` option controls what happens to the original files after compression:
7931+
7932+
* `"both"` — upload both the original and the compressed version. _(default)_
7933+
* `"replace"` — upload only the compressed version and serve it with the appropriate `Content-Encoding` header.
7934+
7935+
juno.config.js
7936+
7937+
```
7938+
import { defineConfig } from "@junobuild/config";export default defineConfig({ satellite: { ids: { production: "qsgjb-riaaa-aaaaa-aaaga-cai" }, source: "dist", precompress: { mode: "replace" } }});
7939+
```
7940+
7941+
## Choose the compression algorithm
7942+
7943+
By default, precompression uses **Gzip** (`algorithm: "gzip"`) because it offers a good balance between compression speed, compatibility, and size.
7944+
7945+
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.
7946+
7947+
juno.config.js
7948+
7949+
```
7950+
import { defineConfig } from "@junobuild/config";export default defineConfig({ satellite: { ids: { production: "qsgjb-riaaa-aaaaa-aaaga-cai" }, source: "dist", precompress: { algorithm: "brotli" } }});
78817951
```
78827952

78837953
### Encoding

docs/build/components/gzip.mdx

Lines changed: 0 additions & 35 deletions
This file was deleted.
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
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.
2+
3+
By default, precompression stores **both** the original and compressed versions in Storage.
4+
5+
You can disable it entirely or customize which files are precompressed, whether to keep originals, and which compression algorithm to use.
6+
7+
:::note
8+
9+
If you change the precompress configuration and your project has already been deployed, run `juno clear` before redeploying to ensure you change is applied.
10+
11+
:::
12+
13+
## Disable precompression
14+
15+
Set the `precompress` option to `false` in your configuration:
16+
17+
```javascript title="juno.config.js"
18+
import { defineConfig } from "@junobuild/config";
19+
20+
export default defineConfig({
21+
satellite: {
22+
ids: {
23+
production: "qsgjb-riaaa-aaaaa-aaaga-cai"
24+
},
25+
source: "dist",
26+
precompress: false
27+
}
28+
});
29+
```
30+
31+
## Customize the file matching pattern
32+
33+
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:
34+
35+
```javascript title="juno.config.js"
36+
import { defineConfig } from "@junobuild/config";
37+
38+
export default defineConfig({
39+
satellite: {
40+
ids: {
41+
production: "qsgjb-riaaa-aaaaa-aaaga-cai"
42+
},
43+
source: "dist",
44+
precompress: {
45+
pattern: "**/*.jpg" // precompress JPEG files only
46+
}
47+
}
48+
});
49+
```
50+
51+
## Decide what happens to original files
52+
53+
The `mode` option controls what happens to the original files after compression:
54+
55+
- `"both"` — upload both the original and the compressed version. _(default)_
56+
- `"replace"` — upload only the compressed version and serve it with the appropriate `Content-Encoding` header.
57+
58+
```javascript title="juno.config.js"
59+
import { defineConfig } from "@junobuild/config";
60+
61+
export default defineConfig({
62+
satellite: {
63+
ids: {
64+
production: "qsgjb-riaaa-aaaaa-aaaga-cai"
65+
},
66+
source: "dist",
67+
precompress: {
68+
mode: "replace"
69+
}
70+
}
71+
});
72+
```
73+
74+
## Choose the compression algorithm
75+
76+
By default, precompression uses **Gzip** (`algorithm: "gzip"`) because it offers a good balance between compression speed, compatibility, and size.
77+
78+
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.
79+
80+
```javascript title="juno.config.js"
81+
import { defineConfig } from "@junobuild/config";
82+
83+
export default defineConfig({
84+
satellite: {
85+
ids: {
86+
production: "qsgjb-riaaa-aaaaa-aaaga-cai"
87+
},
88+
source: "dist",
89+
precompress: {
90+
algorithm: "brotli"
91+
}
92+
}
93+
});
94+
```

docs/build/hosting/configuration.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ You can customize your hosting environment to fit your needs, including:
88
- Serve a customized 404 page. [Learn how.](#customize-a-404not-found-page)
99
- Set up `redirects` for pages that you've moved or deleted. [Learn how.](#redirects)
1010
- Set up `rewrites`. [Learn how.](#rewrites)
11-
- Tweak `gzip` compression for best performance. [Learn how.](#gzip)
11+
- Customize file `compression` for optimal performance. [Learn how.](#precompress)
1212
- Customize the `encoding` behavior of your files. [Learn how.](#encoding-types)
1313
- Allow your project to be embedded as an `iframe`. [Learn how.](#iframe)
1414
- Customize `assertions` to modify the default verification behavior of the CLI. [Learn how.](#assertions)
@@ -69,9 +69,9 @@ import Rewrites from "../components/rewrites.mdx";
6969

7070
### GZIP
7171

72-
import Gzip from "../components/gzip.mdx";
72+
import Precompress from "../components/precompress.mdx";
7373

74-
<Gzip />
74+
<Precompress />
7575

7676
### Encoding types
7777

docs/reference/configuration.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ import IgnoreFiles from "../build/components/ignore-files.mdx";
7373

7474
<IgnoreFiles />
7575

76-
### GZIP
76+
### Precompress
7777

78-
import Gzip from "../build/components/gzip.mdx";
78+
import Precompress from "../build/components/precompress.mdx";
7979

80-
<Gzip />
80+
<Precompress />
8181

8282
### Encoding
8383

0 commit comments

Comments
 (0)