tailwind css installed but not working in my vite + react project #12312
-
What version of Tailwind CSS are you using? What build tool (or framework if it abstracts the build tool) are you using? vite What version of Node.js are you using? v20.6.1 What browser are you using? chrome What operating system are you using? macos Describe your issue my project use vite + react (i create project select vanilla js and after add react to it ) look this screenshot, none class's css can be find in the style pane |
Beta Was this translation helpful? Give feedback.
Replies: 12 comments 43 replies
-
Hey! Did you update your content config? It looks to me like utilities aren't being generated because it isn't scanning any files. |
Beta Was this translation helpful? Give feedback.
-
hey, my tailwind is working but suggestion is not working, i have the tailwind intelligence installed but still I'm not getting any suggestions. Need help. |
Beta Was this translation helpful? Give feedback.
-
Make sure you don't have spaces here:
I apparently had it as |
Beta Was this translation helpful? Give feedback.
-
@amoeba25 thanks so much for the react-ts solution. it worked |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
@na-zi-ya did you import
In your index.css file? If not do so |
Beta Was this translation helpful? Give feedback.
-
My tailwindcss is also not working, may I ask why? Framework: vite+react-ts here is package.json {
"name": "vite-react-ts-map",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc -b && vite build",
"lint": "eslint .",
"preview": "vite preview"
},
"dependencies": {
"mapbox-gl": "^3.7.0",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"@eslint/js": "^9.9.0",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-react": "^4.3.1",
"autoprefixer": "^10.4.20",
"eslint": "^9.9.0",
"eslint-plugin-react-hooks": "^5.1.0-rc.0",
"eslint-plugin-react-refresh": "^0.4.9",
"globals": "^15.9.0",
"postcss": "^8.4.47",
"tailwindcss": "^3.4.13",
"typescript": "^5.5.3",
"typescript-eslint": "^8.0.1",
"vite": "^5.4.1"
}
}
|
Beta Was this translation helpful? Give feedback.
-
In the vite.config.js, copy and paste this
This is the solution provided earlier, try this @gptkong @na-zi-ya |
Beta Was this translation helpful? Give feedback.
-
Apparently, it worked for me by removing a forward slash from tailwind.config.js.
It came like this, then I removed one forward slash from the line
|
Beta Was this translation helpful? Give feedback.
-
Hello, I am using Preact, Tailwind and Docker. It's not working and I don't get why. My docker-compose file # docker-compose.yml
services:
frontend:
image: node:23-alpine
restart: unless-stopped
volumes:
- '.:/app'
ports:
- '5173:5173'
environment:
- NODE_ENV=development
command: ['npm', 'run', 'dev']
working_dir: /app
networks:
- caddie_network
networks:
caddie_network:
external: true
#name: caddie_network my postcss config // postcss.config.mjs
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}; my tailwind config // tailwind.config.mjs
/** @type {import('tailwindcss').Config} */
export default {
content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}'],
presets: [],
darkMode: 'media', // or 'class'
theme: {
extend: {
colors: {
text: '#cad3f5',
subtext1: '#b8c0e0',
subtext0: '#a5adcb',
overlay2: '#939ab7',
overlay1: '#8087a2',
overlay0: '#6e738d',
surface2: '#5b6078',
surface1: '#494d64',
surface0: '#363a4f',
base: '#24273a',
mantle: '#1e2030',
crust: '#181926',
yellow: '#eed49f',
green: '#a6da95',
sapphire: '#7dc4e4',
teal: '#8bd5ca',
sky: '#91d7e3',
blue: '#8aadf4',
lavender: '#b7bdf8',
peach: '#f5a97f',
maroon: '#ee99a0',
red: '#ed8796',
mauve: '#c6a0f6',
pink: '#f5bde6',
flamingo: '#f0c6c6',
rose: '#f4dbd6',
},
},
},
plugins: [],
}; my vite config //vite.config.ts
// eslint-disable-next-line import/no-named-as-default
import preact from '@preact/preset-vite';
import { defineConfig } from 'vite';
import tsconfigPaths from 'vite-tsconfig-paths';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [preact(), tsconfigPaths()],
server: {
proxy: {
'/api': {
target: 'http://backend:3001',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''),
configure: (proxy) => {
proxy.on('error', (err) => {
console.log('proxy error', err);
});
proxy.on('proxyReq', (_proxyReq, req) => {
console.log('Sending Request to the Target:', req.method, req.url);
});
proxy.on('proxyRes', (proxyRes, req) => {
console.log('Received Response from the Target:', proxyRes.statusCode, req.url);
});
},
},
},
},
}); I'm having to import the CDN in my index.html and some classes aren't working. It worked for about 1 evening, then it didn't. I tried various tinkering I found here, none of them worked. If you think it's easier to check out the repo you can have a look here : |
Beta Was this translation helpful? Give feedback.
-
no solutions here worked for me ... |
Beta Was this translation helpful? Give feedback.
Hey! Did you update your content config? It looks to me like utilities aren't being generated because it isn't scanning any files.