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

    Boosting Customer Retention with Email and SMS Marketing on Shopify
    Tips & Tricks

    Boosting Customer Retention with Email and SMS Marketing on Shopify

    Learn how to leverage email and SMS marketing to drive repeat sales, increase brand exposure, and improve customer retention for your Shopify store. Discover practical strategies and actionable tips to enhance your marketing efforts. From personalized messages to timely re-engagement campaigns, we've got you covered.

    June 28, 20262 min
    Connect GitHub to Shopify
    Tips & Tricks

    Connect GitHub to Shopify

    Connecting GitHub to Shopify allows you to version control your theme code, collaborate with your team, and deploy changes smoothly

    June 22, 202610 min
    10 Actionable Shopify SEO Tips to Boost Your Store's Ranking
    Tips & Tricks

    10 Actionable Shopify SEO Tips to Boost Your Store's Ranking

    Improve your Shopify store's visibility and drive more sales with these 10 actionable SEO tips. From keyword optimization to site speed and mobile-first design, learn how to boost your store's ranking and attract more customers. Start optimizing your store today and watch your sales soar.

    June 20, 20264 min
    How to Add a Smooth Back-to-Top Button to Your Shopify Theme
    Tips & Tricks

    How to Add a Smooth Back-to-Top Button to Your Shopify Theme

    Learn how to add a back-to-top button to your Shopify theme with lightweight CSS and JS, improving user experience and navigation. Follow our step-by-step tutorial for a seamless implementation.

    June 18, 20263 min