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:

    sh
    npm install -g @shopify/cli
    shopify theme init

    - Step 2: Install Tailwind CSS

    Inside your theme folder:

    sh
    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:

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

    - Step 4: Update postcss.config.js

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

    - Step 5: Build Tailwind CSS

    Add a script to your package.json:

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

    Then run:

    sh
    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>:

    html
    <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:

    html
    <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

    10 Essential Shopify SEO Tips to Boost Your Store's Traffic
    Tips & Tricks

    10 Essential Shopify SEO Tips to Boost Your Store's Traffic

    Optimize your Shopify store for search engines with these 10 actionable SEO tips, covering setup, keywords, on-page optimization, and technical fixes. Improve your store's visibility, drive more traffic, and increase sales. Get started with Shopify SEO today!

    August 16, 20263 min
    Adding a Smooth Back-to-Top Button to Your Shopify Theme
    Tips & Tricks

    Adding a Smooth Back-to-Top Button to Your Shopify Theme

    Learn how to add a smooth back-to-top button to your Shopify theme using lightweight CSS and JS, improving navigation and enhancing user experience.

    August 13, 20263 min
    Shopify Requires Expiring Offline Access Tokens for Public Apps: What Developers Need to Know
    Tips & Tricks

    Shopify Requires Expiring Offline Access Tokens for Public Apps: What Developers Need to Know

    Shopify is making an important change to how public apps authenticate with the Admin API

    August 8, 202630 min
    Understanding Shopify Theme Check: LiquidHTML/Complexity
    Tips & Tricks

    Understanding Shopify Theme Check: LiquidHTML/Complexity

    Although this isn't a compilation or runtime error, it's an important indicator that your Liquid file has become too complex, making it harder to read, maintain, and extend over time

    July 30, 202620 min