For a more responsive Commerce site, optimize CSS and JavaScript (JS) resource files and eliminate render-blocking resources.
All supported versions, 2.3 and later of:
The time it takes to load CSS and JavaScript (JS) files can be reduced by merging, minifying, and bundling separate files into a single file.
Adobe Commerce on cloud infrastructure always runs on Production mode and it is not possible to set it otherwise, therefore you must use the command-line method to enable merging, minifying, and bundling.
Do not merge or bundle files if your deployment uses HTTP/2. HTTP/2 downloads static files asynchronously. Browsers must download an entire merged file before processing the file contents.
To enable CSS merging or minification, go into the Admin > Stores > Setting > Configuration > Advanced > Developer > CSS Settings.
To enable CSS merging in Adobe Commerce on cloud infrastructure:
Run this command locally:
bin/magento config:set --lock-config dev/css/merge_css_files 1
Commit changes to the app/etc/config.php
file and redeploy.
To enable CSS minification in Adobe Commerce on cloud infrastructure:
Run this command locally:
bin/magento config:set --lock-config dev/css/minify_files 1
Commit changes to the app/etc/config.php
file and redeploy.
On the Admin sidebar, go to Stores > Settings > Configuration > Advanced > Developer > JavaScript Settings.
To enable JS minification in Adobe Commerce on cloud infrastructure:
Run this command locally:
bin/magento config:set --lock-config dev/js/minify_files 1
Commit changes to the app/etc/config.php
file and redeploy.
You can turn on merging or bundling in the Commerce Admin (merging and bundling cannot be enabled at the same time): Stores > Settings > Configuration > Advanced > Developer > JavaScript Settings.
You can also enable Adobe Commerce built-in bundling (basic bundling) from the command line:
php -f bin/magento config:set dev/js/enable_js_bundling 1