Skip to main content
Spree Storefront is built on top of Tailwind CSS 4. After installing Spree you should find a main CSS file: If you’re missing this file, or migrating from a previous version of Spree, you can generate it using the following command:
Tailwind 4 uses a CSS-first configuration approach. There’s no tailwind.config.js file - all configuration is done directly in CSS using the @theme directive.

Basic Structure

Your application.css file should look something like this:
app/assets/tailwind/application.css

Importing Additional CSS Files

Create a new CSS file in the app/assets/stylesheets directory:
In the my_custom_styles.css file, add your styles:
Then import it in your application.css file:
app/assets/tailwind/application.css

Importing 3rd Party CSS Libraries

You can import a 3rd party CSS library directly from a CDN:
app/assets/tailwind/application.css

CSS Variables

Spree Storefront uses CSS variables that are automatically injected into the page. This allows store owners to change colors, fonts, etc. from the admin dashboard via Page Builder. The default variables look like this:
app/assets/tailwind/application.css
They are defined in the app/views/themes/default/spree/shared/_css_variables.html.erb file which should be present in your theme.

Customizing with @theme

Tailwind 4 uses the @theme directive for customizations. You can extend or override the default theme:
app/assets/tailwind/application.css
Then use them in your templates:

Overriding Section Styles

Each section has CSS classes you can target to customize its appearance:

Using Tailwind Utility Classes

You can use Tailwind utility classes directly in your templates:

Arbitrary Values

Tailwind 4 supports arbitrary values for one-off customizations:

Variant Modifiers

Use variant modifiers for responsive and state-based styles:

Adding Custom Utilities

You can add custom utilities using standard CSS with the @utility directive:
Then use them like any other utility:

Adding Custom Variants

Create custom variants with the @variant directive:
Use them in your templates: