barrel / shopify-vite

Modern frontend tooling for Shopify theme development using Vite for a best-in-class DX.
https://shopify-vite.barrelny.com/
MIT License
287 stars 45 forks source link

Tailwind CSS styles not updating during Hot Module Reloading #109

Closed joshua-isaac closed 1 year ago

joshua-isaac commented 1 year ago

Hi All,

First of all, awesome package!

I seem to be having an issue where the Tailwind CSS styles I am applying to HTML elements are not updating during hot module reloading. I believe I have all the requirements, however I am stuck on figuring out what may be missing.

In my /frontend/entrypoints directory i have the following inside main.css:

@tailwind base;
@tailwind components;
@tailwind utilities;

I've updated my dev command to the following:

{
    "version": "0.0.0",
    "private": true,
    "type": "module",
    "scripts": {
      "dev": "run-p -sr \"shopify:dev -- {@}\" \"vite:dev\" --", 
      "deploy": "run-s \"build\" \"shopify:push -- {@}\" --", 
      "shopify:dev": "shopify theme dev --live-reload full-page", 
      "vite:dev": "vite", 
      "shopify:push": "shopify theme push", 
      "build": "vite build"
    },
    "devDependencies": {
      "npm-run-all": "^4.1.5", 
      "vite": "^4.2.1",
      "vite-plugin-shopify": "^2.0.2"
    }
  }

vite.config.js:

import { defineConfig } from 'vite'
import shopify from 'vite-plugin-shopify'

export default defineConfig({
  plugins: [
    shopify()
  ],
  build: {
    emptyOutDir: false
  }
})

Attached is a quick loom recording: https://www.loom.com/share/aac1c4ea848646e3a5e4f88f63cb9b21?sid=fb82e0b3-895f-45cd-8a29-c48129b2cc50

Appreciate any help!

joshua-isaac commented 1 year ago

didnt realize tailwind classes had a prefix 😅 closing the issue