Magento for B2B Commerce, 2.2.x
Optimizing Resource Files

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.

For technical information, see Magento Optimization Guide in the developer documentation.

CSSCascading Style Sheets: A style sheet language that controls the appearance of HTML documents; a way to control the appearance of text, graphics, lists, links, and all other elements on a web page. and JavaScriptA scripting language used with HTML to produce dynamic effects and interactions on web pages. files can be optimized in Developer Mode only.

  • File Type

    Supported Operations

    CSS Files

    • Merge
    • Minify

    JavaScript Files

    • Merge
    • Bundle
    • Minify

    Template Files

    • Minify

To optimize resource files:

1. On the Admin sidebar, tap Stores. Then under Settings, choose Configuration.
2. In the panel on the left under Advanced, choose Developer.
3. To optimize CSS files, do the following:
a. Expand the CSS Settings section. Then, do the following:
b. Set Merge CSS Files to “Yes.”
c. Set Minify CSS Files to “Yes.”
4. To optimizeJavaScript files, do the following:
a. Expand the JavaScript Settings section. Then, do the following:

 

b. Set Merge JavaScript Files to “Yes.”
c. Set Minify JavaScript Files to “Yes.”
5. To minify PHTML template files, do the following:
a. Expand the Template Settings section.
b. Set Minify Html to “Yes.”
6. When complete, tap Save Config.