Important

You are browsing the documentation for version 4.2 of OroCommerce, OroCRM and OroPlatform, which is no longer maintained. Read version 5.1 (the latest LTS version) of the Oro documentation to get up-to-date information.

See our Release Process documentation for more information on the currently supported and upcoming releases.

Optimize Build Performance of CSS and JavaScript Assets

Hint

This feature is available starting from OroPlatform v4.2.5. To check which application version you are running, see the system information.

There are two factors that affect the build performance of CSS and JavaScript asset the most, JavaScript compilation with Babel and the number of enabled layout themes.

JavaScript Compilation with Babel

Babel processes JavaScript to make it compatible with older browsers. Because there are many asset files to process, resource consumption is high.

If you have to support only the latest version of mainstream browsers, consider disabling Babel for the project by adding the below configuration to the config/config.yml file:

config/config.yml
oro_asset:
    disable_babel: true

Enabled Layout Themes

Layout themes in OroCommerce can extend each other, but to avoid side effects during the build, every layout theme in the OroCommerce application is fully isolated. Therefore, the build time and resource consumption directly depend on the number of enabled themes. All the available themes are enabled out of the box, including the three default ones (blank, default, and custom). In most cases, the default themes are unnecessary in a custom application with its own themes and custom CSS and JavaScript.

To build only the themes that are in use and disable the rest, provide the list of enabled themes by adding the following configuration to the config/config.yml file:

config/config.yml
oro_layout:
    enabled_themes: [acme_default_theme, custom_theme_for_german_website]