Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 82 additions & 12 deletions .llms-snapshots/llms-full.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -1804,24 +1804,59 @@ 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.

**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:

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" } }});
```

## 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
Expand Down Expand Up @@ -7858,26 +7893,61 @@ 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.

**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:

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" } }});
```

## 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
Expand Down
35 changes: 0 additions & 35 deletions docs/build/components/gzip.mdx

This file was deleted.

94 changes: 94 additions & 0 deletions docs/build/components/precompress.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
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.

:::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:

```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"
}
}
});
```

## 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"
}
}
});
```
6 changes: 3 additions & 3 deletions docs/build/hosting/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -69,9 +69,9 @@ import Rewrites from "../components/rewrites.mdx";

### GZIP

import Gzip from "../components/gzip.mdx";
import Precompress from "../components/precompress.mdx";

<Gzip />
<Precompress />

### Encoding types

Expand Down
6 changes: 3 additions & 3 deletions docs/reference/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ import IgnoreFiles from "../build/components/ignore-files.mdx";

<IgnoreFiles />

### GZIP
### Precompress

import Gzip from "../build/components/gzip.mdx";
import Precompress from "../build/components/precompress.mdx";

<Gzip />
<Precompress />

### Encoding

Expand Down