DEV Community

Qrolic Technologies
Qrolic Technologies

Posted on

1 2

How to Link CSS and JS File in Shopify?

In this tutorial, I will show you how to link CSS and JS files.

First of all, open the template.liquid file and navigate to the inner head tag.

To link a CSS file, add this code:

<linkrel="stylesheet" href="{{'theme.css'|asset_url}}" type="text/css")">
Enter fullscreen mode Exit fullscreen mode

And add the following code to link JS file:

<script src="{{'theme.js'|asset_url}}" defer="defer"></script> 
Enter fullscreen mode Exit fullscreen mode

Now you are done. Run your app to test this code.

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay