Skip to main content

The assets folder

Everything in assets/ is served publicly. Keep files flat, subfolders are not supported.

Tailwind

Most official themes are Tailwind-based. If your theme has a tailwind.config.js at its root, the Theme CLI compiles assets/style.css into assets/built.css on every change, with no setup on your side.
tailwind.config.js
Because content scans your .njk files, a class only survives the build if it appears literally in a template. Dynamically assembled class names get purged:
The pro theme is the exception. It is built on Bootstrap and has no tailwind.config.js, so nothing is compiled for it.

Design tokens

This is the part worth understanding before you restyle anything. Theme settings do not get compiled into CSS. The layout emits them as CSS custom properties at render time, and tailwind.config.js maps utility class names onto those properties. The result is that changing a color in the visual editor updates the page without rebuilding any CSS. The chain, using the accent color:
1

A setting in schema.json

2

The layout emits it as a custom property

hex_to_rgb converts the hex value into channels so it can be used with an alpha component.
layouts/master.njk
3

Tailwind maps a color name onto it

tailwind.config.js
4

Templates use the utility class

The Canvas theme wires up tokens for colors (--cl-*), radii (--radius-*), shadows (--shadow-*), fonts (--ff-*, --fw-*), spacing (--section-py, --card-pad, --grid-gap), the container width (--container-max), and the transition duration (--dur). Follow the same pattern when you add a setting that should affect styling: emit a custom property in the layout, map it in tailwind.config.js, use the utility in your templates.

Color schemes

Light and dark are driven by a data-scheme attribute on <html>, with darkMode: ['selector', '[data-scheme="dark"]'] in the Tailwind config. Each scheme redefines the same custom properties, so components do not need per-scheme classes:

Custom CSS and JS

assets/custom.css and assets/custom.js are the only asset files preserved when a theme is updated from its official base. They are the right place for merchant-specific tweaks. To make that practical, the newer official themes put a stable sa- class on every section and key element. These classes carry no styles of their own, they exist purely as selectors:
assets/custom.css
If you are building a theme from scratch, adopt the same convention. It is what lets merchants restyle without touching Tailwind, and it survives your theme updates.

Referencing assets

Use assetUrl for files in your own theme. It appends a version parameter so browsers pick up changes immediately:
Use staticAsset for libraries SellAuth hosts. Loading them this way is faster and avoids a third-party dependency:
Available libraries:

JavaScript

The official themes use Alpine.js for interactivity. The layout puts an x-data root on the app container and the theme registers its component in script.js:
assets/script.js
Server-rendered values are handed to the client through an inline script in the layout, using the json filter:

Upload rules

The CLI, the code editor, and the visual editor accept these file types:
Per-file size limits depend on the shop’s plan.
In watch mode the CLI only pushes text files (njk, html, css, js, json, txt, md, xml, svg). Add images and fonts with a full push, or upload them from the dashboard.