I saved a CSS and HTML file in Assets folder; how do I get an url for it?

Hi All,

I am new to this. I wanted to display PMS Color chart on my website and a friend of mine sent me a zip file that has a CSS file and a HTML file and when I open the HTML file on my computer, it works perfectly fine. After reading about theme customization etc on these pages, I added these two files to the Assets folder in my theme. Now, I have no idea how to generate a url that I could use on my website.

Any help will be appreciated.

2 Likes

Hello, @OasisPromos

Welcome to the Shopify community!
and Thanks for your Good question.

can please add this code theme.liquid before
just change css file name custom.scss.css to your CSS file name

{{ 'custom.scss.css' | asset_url | stylesheet_tag }}
1 Like

Hi @KetanKumar ,

Thank you very much for taking the time and helping me with this question. I added the following line to theme.liquid file:

{{ ‘colors.scss.css’ | asset_url | stylesheet_tag }} but I still don’t know how to generate a page or url address for the file. Can you please guide me.

Once again, thank you very much for your help!

Hi @KetanKumar ,

I found the url address. Thank you very much for all your help; I really appreciate it.

Abdul

1 Like

@OasisPromos

Thanks for update and compliment

Hi, I’m going through the same question: where did you find the url please?

I want to get an always-latest url for the CSS file loaded under the Assets. I edit and update the CSS file a lot, and I don’t want to update the link every time after.

Could you please shed some lights?

1 Like

@ronald_r

Sorry you are facing this issue, it would be my pleasure to help you.

Welcome to the Shopify community! :blush:
Thanks for your good question.

Please share your site URL,
I will check out the issue and provide you a solution here.

@KetanKumar

Hi, thanks for your reply!

Site URL: https://jgmaker3d.myshopify.com/

So again, for explaining what I’m facing:

I added a CSS file (name: style.css.liquid) on Assets folder, I figured out the link of this file and included in product page’s custom HTML section:


The thing is, when I edit and update the CSS file, the link for the updated file changes with question mark and different version number appended.

I tried to add {{ ‘style.css.liquid’ | asset_url | stylesheet_tag }} before in theme.liquid; and then change the code on the custom HTML section like this:


It fails to get the latest link of the CSS file. Could you shed some lights? Thanks a lot in advance!

Ronald

1 Like

@ronald_r

can you please try this code

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

@KetanKumar

Thanks very much! Issue solved!

Works good now after I remove the .liquid in the code in the theme.liquid, and remove the .liquid in the code in the custom HTML section:

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

So it might turn out that the “.liquid” can not be recognized following the “stylesheet_tag”.

I’m not sure if it is the reason, I hope I could have learnt more about this language, but thanks again for the solution!

1 Like

@ronald_r

it’s my pleasure to help us