Magento 2 Defer Parsing of JavaScript Pro

Table of Content

  1. Extension Installation Guide
  2. Configuration
  3. Before Implementation of Defer Parsing of JavaScript
  4. After Implementation of Defer Parsing of JavaScript

 

  1. Extension Installation
    • Extract the zip folder and upload our extension to the root of your Magento 2 directory via FTP.
    • Login to your SSH and run below commands step by step:
      • php bin/magento setup:upgrade
      • For Magento version 2.0.x to 2.1.x - php bin/magento setup:static-content:deploy
      • For Magento version 2.2.x & above- php bin/magento setup:static-content:deploy -f
      • php bin/magento cache:flush
    • That’s it.

 

  1. Configuration
    For configuring the extension, log in to Magento 2, move to Stores > Configuration > Defer Parsing of JavaScript where you can find various settings to enable the extension.
  • Defer Parsing of JavaScript: Enable Defer Parsing of JavaScript extension.
  • Exclude Home Page: Set YES to exclude the home page from the defer parsing of JavaScript.
  • Exclude Controllers: Add controllers to exclude from defer parsing of JavaScript.
  • Exclude Paths: Enter paths to exclude from defer parsing of JavaScript.


  

  1. Before Implementation of Defer Parsing of JavaScript
    If you check any low-speed Magento 2 website in Google PageSpeed, you can see the recommendation for Defer Parsing of JavaScript which is having the low grade as shown in below image. 


  

  1. After Implementation of Defer Parsing of JavaScript
    After implementation of Defer Parsing of JavaScript in Magento 2 store, you can see the better grade in Google PageSpeed for JavaScript as shown below. All the excluded page, controllers and path will no longer deferred parsing of JavaScript. The improvement of grade helps in improvement of website load time.