Skip to content

Commit 48e4e4e

Browse files
committed
minor #20456 [AssetMapper] mention Zopfli pre-compression and add config for web servers (dunglas)
This PR was merged into the 7.3 branch. Discussion ---------- [AssetMapper] mention Zopfli pre-compression and add config for web servers Follows #20446 Commits ------- 1d690fc [AssetMapper] mention Zopfli pre-compression and add config for web servers
2 parents 2ac5e58 + 1d690fc commit 48e4e4e

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

frontend/asset_mapper.rst

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,7 @@ installed the following PHP extensions or CLI commands:
726726

727727
* Brotli: ``brotli`` CLI command; `brotli PHP extension`_;
728728
* Zstandard: ``zstd`` CLI command; `zstd PHP extension`_;
729-
* gzip: ``gzip`` CLI command; `zlib PHP extension`_.
729+
* gzip: ``zopfli`` (better) or ``gzip`` CLI command; `zlib PHP extension`_.
730730

731731
Then, update your AssetMapper configuration to define which compression to use
732732
and which file extensions should be compressed:
@@ -751,6 +751,27 @@ compressed files are created with the same name as the original but with the
751751
precompression will use the compressed assets automatically, so there's nothing
752752
else to configure in your server.
753753

754+
Finally, you need to configure your web server to serve the precompressed assets
755+
instead of the original ones:
756+
757+
.. configuration-block::
758+
759+
.. code-block:: caddy
760+
761+
file_server {
762+
precompressed br zstd gzip
763+
}
764+
765+
.. code-block:: nginx
766+
767+
gzip_static on;
768+
769+
# Requires https://github.com/google/ngx_brotli
770+
brotli_static on;
771+
772+
# Requires https://github.com/tokers/zstd-nginx-module
773+
zstd_static on;
774+
754775
.. tip::
755776

756777
AssetMapper provides an ``assets:compress`` CLI command and a service called

0 commit comments

Comments
 (0)