Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AssetMapper] mention Zopfli pre-compression and add config for web servers #20456

Merged
merged 1 commit into from
Jan 3, 2025
Merged
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
23 changes: 22 additions & 1 deletion frontend/asset_mapper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@

* Brotli: ``brotli`` CLI command; `brotli PHP extension`_;
* Zstandard: ``zstd`` CLI command; `zstd PHP extension`_;
* gzip: ``gzip`` CLI command; `zlib PHP extension`_.
* gzip: ``zopfli`` (better) or ``gzip`` CLI command; `zlib PHP extension`_.

Then, update your AssetMapper configuration to define which compression to use
and which file extensions should be compressed:
Expand All @@ -751,6 +751,27 @@
precompression will use the compressed assets automatically, so there's nothing
else to configure in your server.

Finally, you need to configure your web server to serve the precompressed assets
instead of the original ones:

.. configuration-block::

.. code-block:: caddy

file_server {
precompressed br zstd gzip

Check failure on line 762 in frontend/asset_mapper.rst

View workflow job for this annotation

GitHub Actions / Code Blocks

[PHP syntax] Syntax error, unexpected T_STRING
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xabbuh its weird to have this error in a caddy code-block 🤔

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the docs builder somehow map caddy to PHP?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I merged this despite the error. Let's see if the error persists and how can we fix it. Thanks!


.. code-block:: nginx

gzip_static on;

# Requires https://github.com/google/ngx_brotli
brotli_static on;

# Requires https://github.com/tokers/zstd-nginx-module
zstd_static on;

.. tip::

AssetMapper provides an ``assets:compress`` CLI command and a service called
Expand Down
Loading