How to Add Tailwind CSS to Shopify

Learn how to add Tailwind CSS to Shopify for faster, responsive design. Enhance your store’s look with clean, utility-first styling. Perfect for theme customization

How to Add Tailwind CSS to Shopify
3 sections

Why Add Tailwind CSS to Shopify?

Tailwind CSS is a utility-first CSS framework that makes it faster and easier to build custom UI directly in your HTML. Here’s why it’s great for Shopify:

  • 🔧 Faster Development: Write styles inline with HTML classes—no need for custom CSS files.
  • 🎨 Fully Customizable: Tailor your design system with ease.
  • 📱 Responsive by Default: Built-in responsive design utilities.
  • Clean & Consistent UI: Enforces design consistency across your storefront.
  • Step-by-Step: How to Add Tailwind CSS to Shopify

    💡 You can’t use Tailwind directly via CDN with all of its features (especially @apply, custom builds, etc.). So it’s recommended to compile Tailwind via a build process, then add the output CSS to Shopify.

    📌 Option 1: Add Tailwind CSS using Shopify + ThemeKit + Tailwind CLI

    - Step 1: Set Up Your Local Development Environment

    If you haven't already, set up Shopify's local dev tools:

    npm install -g @shopify/cli
    shopify theme init

    - Step 2: Install Tailwind CSS

    Inside your theme folder:

    npm init -y
    npm install -D tailwindcss postcss autoprefixer
    npx tailwindcss init

    This creates tailwind.config.js and postcss.config.js.

    - Step 3: Create Your CSS File

    Create a CSS file like tailwind.css in your assets folder:

    /* assets/tailwind.css */
    @tailwind base;
    @tailwind components;
    @tailwind utilities;

    - Step 4: Update postcss.config.js

    module.exports = {
      plugins: {
        tailwindcss: {},
        autoprefixer: {},
      },
    }

    - Step 5: Build Tailwind CSS

    Add a script to your package.json:

    "scripts": {
      "build:css": "tailwindcss -i ./assets/tailwind.css -o ./assets/tailwind.css --minify"
    }
    

    Then run:

    npm run build:css

    This generates tailwind.css with Tailwind classes.

    📌 Option 2: Basic CDN Method (Quick & Limited)

    For very basic usage/testing, you can add this CDN in your theme.liquid <head>:

    <link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
    ⚠️ This method doesn't support PurgeCSS or Tailwind's advanced features.

    ✨ Final Step: Use Tailwind in Your HTML

    Now you can write Tailwind classes directly in your Shopify Liquid files, like:

    <div class="bg-blue-500 text-white p-4 rounded">
      Hello Tailwind in Shopify!
    </div>

    Things to Keep in Mind

  • Shopify’s default styles might conflict — reset them or use utility classes carefully.
  • Tailwind increases file size — use purge in production.
  • You may need to customize the Tailwind config if you're using Shopify sections/components.
  • Tags

    Related Articles

    Boost Sales Today: The Simple Power of Free Shipping Thresholds for Shopify Stores
    Tips & Tricks

    Boost Sales Today: The Simple Power of Free Shipping Thresholds for Shopify Stores

    Discover how implementing a strategic free shipping threshold can dramatically increase your Shopify store's conversion rates and average order value. Learn quick, actionable steps for both merchants and developers to set up and optimize this powerful tactic within a single day.

    May 16, 20266 min
    Boost Conversions: How to Add a Countdown Timer to Your Shopify Store
    Tips & Tricks

    Boost Conversions: How to Add a Countdown Timer to Your Shopify Store

    Learn how to add an urgency-driving countdown timer to your Shopify product pages and sales promotions. This tutorial covers methods from theme editor blocks to custom Liquid code and when to choose a dedicated app, helping you drive conversions.

    May 14, 20268 min
    Convert a Shopify Section to a Block (Horizon Theme version)
    Tips & Tricks

    Convert a Shopify Section to a Block (Horizon Theme version)

    In Horizon, Shopify allows developers to convert standalone sections into reusable blocks, giving merchants even more control in the theme editor. Let’s walk through the process step by step.

    May 10, 20267 min
    Bulk import and create new Shopify Online Store Navigation Menus
    Tips & Tricks

    Bulk import and create new Shopify Online Store Navigation Menus

    Use Excel or CSV spreadsheet files to easily migrate and create new complex navigation menu structures for your store.

    May 10, 20261 min