Goal: load custom CSS from a separate file instead of editing base.css in a Shopify theme.
Key approaches suggested:
Upload your custom .css to Assets (Online Store > Themes > Edit code > Assets > Add a new asset). Then include it:
⢠In base.css using an @import rule: @import url(â{{ âyour-custom.cssâ | asset_url }}â);
⢠Or in theme.liquid after the base.css line using a separate stylesheet tag: {{ âyour-custom.cssâ | asset_url | stylesheet_tag }}.
Clarifications:
Shopify has no asset build/bundling step. You canât âattachâ files in a build sense; you either import from base.css or link the file directly in theme.liquid.
Another option is to inline styles via a snippet in theme.liquid, though keeping a separate asset is cleaner.
Notes on implementation:
Liquid helpers used: asset_url (generates the asset URL) and stylesheet_tag (outputs a tag).
Code snippets are central to applying the solutions.
Status: Practical, actionable methods provided. No explicit resolution from the original poster; approaches are compatible and can be adopted immediately.
Summarized with AI on December 12.
AI used: gpt-5.
In Shopify, to include a custom CSS file without directly editing the base.css, you can link your custom CSS file by adding an @import rule to the base.css or the appropriate theme file. Hereâs how:
Upload the Custom CSS File:
Go to your Shopify Admin > Online Store > Themes > Actions > Edit Code. In the Assets folder, click Add a new asset and upload your .css file.
Edit the base.css or theme.css File:
Locate the base.css or main CSS file in the Assets folder and add the following line at the top or where appropriate:
You can add this file to your theme by adding it below this file code to theme.liquid file. Below this line of code â{{ âbase.cssâ | asset_url | stylesheet_tag }}â