Hello Magento Friends,
Today I am going to explain optimizing resource files of your Magento 2 store.
As you optimize website content and images, it is equally important to optimize the resource files. Let’s understand it deeply.
Ways to Optimize Resource Files in Magento 2:
Optimizing resource files means decreasing the load time of resource files. There are three ways you can optimize the resource files in Magento 2:
- Merging Files – It will combine files of the same type into a single file.
- Bundling Files – It will make a group of separate files in order to reduce HTTP requests.
- Minifying Code – Code minification will remove spaces, line breaks, and comments.
Default Magento does not merge, bundle, or minify files. You can perform these actions using the below steps.
Steps to Optimize Resource Files in Magento 2:
Step 1: General Configuration
- From the Admin Panel, go to Stores > Settings > Configuration.
- Now, from the left-hand side menu panel, expand the ADVANCED option and select Developer.
Step 2: Optimize CSS Files
- Expand the CSS Settings.
- Now set Merge CSS Files and Minify CSS Files fields to Yes.
Step 3: Optimize JS Files
Step 4: Optimize PHTML Files
- Expand the Template Settings.
- Then set the Minify Html field to Yes.
When completed, click the Save Config button.
Using the above steps, you can optimize resource files in Magento 2 and speed up the page loading. Check out more ways to improve the speed of the Magento 2 store. Share the article with Magento merchants and stay updated for more tutorials on Magento 2.