I've loaded a CSS file in Assets folder, how do I get the latest version of an url for it?

Solved
ronald_r
Tourist
5 1 3

Hi All,

I'm new here. I added a CSS file (name: style.css.liquid) under the Assets folder in my theme. And I figured out the link for the CSS file is: https://cdn.shopify.com/s/files/.../assets/style.css.liquid , so I included it in my page custom HTML section and it works fine:

<link href="https://cdn.shopify.com/s/files/.../assets/style.css.liquid " doctype="text/css" rel="stylesheet" >

However, when I try to edit and update the CSS file in the Assets, I found the link https://cdn.shopify.com/s/files/.../assets/style.css.liquid is to my previous version file, I figured out the link for the updated file should be appended a question mark and a version number: ...style.css.liquid?2 

Now I want to know how do I always get the latest version of the link? I learnt I should add  {{ 'style.css.liquid' | asset_url | stylesheet_tag }} before  </head> in theme.liquid.

And then I edited the href value but fail: 

<link href="{{ 'style.css.liquid' | asset_url | stylesheet_tag }} " doctype="text/css" rel="stylesheet" >

I don't know why it fails, could anyone shed some lights on me? any help will be much appreciated!

0 Likes
ronald_r
Tourist
5 1 3

This is an accepted solution.

Remove the ".liquid" in theme.liquid as well as the custom HTML section, it should look as follow:

 

{{ 'style.css' | asset_url | stylesheet_tag }}

 

 

0 Likes