Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hi @grkarthik,
In order to work on the 'eliminate render blocking resources', you have to apply two different techniques for CSS and JS files.
For CSS files:
you have to preload the CSS files as shown in below
{% comment %}preload the css file as in below line.{% endcomment %}
<link rel="preload" as="style" href="{{ 'file_name.css' | asset_url }}"/>
{% comment %} use the preloaded css file like normally you do on shopify.{% endcomment %}
<link rel="stylesheet" href="{{ 'file_name.css' | asset_url }}"/>
To work on JS files you have to work using 'async' and 'defer' attributes of html.
async is used to allow downloading of resources and execute the script whenever required.
whereas defer is used to allow javascript execution only when the html has fully parsed.
{% comment %} ASYNC EXAMPLE {% endcomment %}
<script src="{{ 'file_name.js' | asset_url }}" async></script>
{% comment %} DEFER EXAMPLE {% endcomment %}
<script src="{{ 'file_name.js' | asset_url }}" defer></script>
as in the image you shared you need to add the async attribute to the jquery script tag and add defer tags on all jquery dependent js script files. While using async and defer you have to ensure that there are no inline or internal scripts written else this will raise an error.
To learn more about eliminate render blocking resources you can refer to this link.
Thanks & Regards
KaalTech
Hi @grkarthik,
I’m Richard Nguyen - CRO Expert at PageFly.
I'd like to recommend the steps below in order to eliminate Render-Blocking resources:
The CSS - JS needed to render the above-the-fold sections of the page should be delivered inline in the HTML(Critical CSS).
1. For CSS, you can preload the CSS files as shown in the example below:
<link rel=”preload” as=”style” href=”{{ ‘base.css ’ | asset_url }}”/>
and then add the CSS normally you do in Shopify:
<link rel=”stylesheet” href=”{{ 'base.css ’ | asset_url }}”/>
2. For Javascript files, you can use async and defer attributes to the script tag to remove the issue.
<script src=”{{ ‘theme.js ’ | asset_url }}” async></script>
Defer - the defer attribute ensures that the script has to be executed only after the page has finished parsing.
<script src=”{{ ‘theme.js ’ | asset_url }}” defer></script>
!IMPORTANT: Reduce Unused Javascript issues can be fixed only when you have template-specific files. In Shopify, we have js files such as theme.js, and vendor.js, which are almost called throughout, and we cannot do anything about that because if you modify these js files, it can lead to breaking the whole site.
And that's my feedback. Hope it's helpful to you 😊
Cheers!
Richard
P/s: That being said, you can check this guide for more details on how to boost page speed. And in case you would like to optimize your front store as well, you can check out our template here
Please let me know if it works by giving it a Like or marking it as a solution!
➜ Optimize your Shopify store with PageFly Page Builder (Free plan available)
All features are available from Free plan. Live Chat Support is available 24/7.
Hello @grkarthik,
The eliminate render-blocking resources are caused by both the javascript files and the CSS files. In order to fix the “eliminate render-blocking resources”, you have to apply two separate techniques for CSS and Javascript files.
For CSS, you can preload the CSS files as shown in the example below:
<link rel=”preload” as=”style” href=”{{ ‘css_file.css ’ | asset_url }}”/>
and then add the CSS normally you do in Shopify:
<link rel=”stylesheet” href=”{{ ‘css_file.css ’ | asset_url }}”/>
For Javascript files, you can use async and defer attributes to the script tag to remove the issue.
<script src=”{{ ‘script_file.js ’ | asset_url }}” async></script>
<script src=”{{ ‘script_file.js ’ | asset_url }}” defer></script>
The use of both the above keywords ensures that the render-blocking issues are removed from the script files.
Hope this resolves your issue, let us know if you need any further assistance.
All the best,
CedCommerce
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025