After July 2021, the 2.3.x release line no longer received quality updates or user guide updates. PHP 7.3 reached end of support in December 2021, and Adobe Commerce 2.3.x reached end of support in September 2022. We strongly recommend upgrading to Adobe Commerce 2.4.x to help maintain PCI compliance.

Optimizing Resource Files

This site contains archived merchant documentation for a version of Adobe Commerce and Magento Open Source that has reached end-of-support. The documentation available here is intended for historical reference only and is not maintained. The Adobe Commerce Merchant Documentation for current releases is published on the Adobe Experience League.

The time it takes to load resource files can be reduced by merging and bundling files, and by minimizing code.

  • Merging combines separate files of the same type into a single file.
  • Bundling is a technique that groups separate files in order to reduce the number of HTTP requests that are required to load a page.
  • Minification removes spaces, line breaks, and comments, but does not affect the functionality of the code. Because minimized files cannot be edited, the process should be applied only when you are ready to go into production.

By default, Magento does not merge, bundle, or minimize files, and the project developer should determine which file optimization methods should be used.

See Magento Optimization Guide in the developer documentation.

CSS and JavaScript files can be optimized in Developer Mode only.

File Type Supported Operations
CSS Files MergeMinify
JavaScript Files MergeBundleMinify
Template Files Minify

Optimize resource files

  1. On the Admin sidebar, go to Stores > Settings > Configuration.

  2. In the left panel, expand Advanced and choose Developer.

  3. To optimize CSS files, expand Expansion selector the CSS Settings section and do the following:

    • Set Merge CSS Files to Yes.
    • Set Minify CSS Files to Yes.

    Advanced configuration - CSS settings CSS Settings

  4. To optimize JavaScript files, expand Expansion selector the JavaScript Settings section and do the following:

    • Set Merge JavaScript Files to Yes.
    • Set Minify JavaScript Files to Yes.

    Advanced configuration - Javascript settings JavaScript Settings

  5. To minify PHTML template files, expand Expansion selector the Template Settings section and set Minify Html to Yes.

    Advanced configuration - template settings Template Settings

  6. When complete, click Save Config.