create-huenei-template 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-component/SKILL.md +288 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-component/references/component-patterns.md +358 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-di/SKILL.md +387 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-di/references/di-patterns.md +519 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-directives/SKILL.md +437 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-directives/references/directive-patterns.md +570 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-forms/SKILL.md +434 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-forms/references/form-patterns.md +398 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-http/SKILL.md +366 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-http/references/http-patterns.md +448 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-routing/SKILL.md +395 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-routing/references/routing-patterns.md +472 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-signals/SKILL.md +302 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-signals/references/signal-patterns.md +404 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-ssr/SKILL.md +435 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-ssr/references/ssr-patterns.md +497 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-testing/SKILL.md +660 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-testing/references/testing-patterns.md +707 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-tooling/SKILL.md +352 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/angular-tooling/references/tooling-patterns.md +448 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-accessibility/SKILL.md +780 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-components/SKILL.md +718 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-design-systems/SKILL.md +612 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-layouts/SKILL.md +594 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-animations/SKILL.md +432 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-animations/references/animation-patterns.md +427 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-debugging/SKILL.md +354 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-debugging/references/troubleshooting-guide.md +306 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-framework-integration/SKILL.md +578 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-framework-integration/references/react-patterns.md +353 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/SKILL.md +608 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/references/advanced-theme-patterns.md +215 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/references/custom-utilities-guide.md +281 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-mobile-first/SKILL.md +768 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-performance/SKILL.md +374 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-performance/references/bundle-optimization.md +244 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-plugins/SKILL.md +505 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-responsive-darkmode/SKILL.md +601 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-responsive-darkmode/references/advanced-responsive-patterns.md +485 -0
- package/dist/templates/frontend/angular-base/.cursor/skills/web-design-guidelines/SKILL.md +39 -0
- package/dist/templates/frontend/angular-base/package.json +0 -1
- package/dist/templates/frontend/angular-base/pnpm-lock.yaml +8183 -0
- package/package.json +1 -1
- package/templates/frontend/angular-base/.cursor/skills/angular-component/SKILL.md +288 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-component/references/component-patterns.md +358 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-di/SKILL.md +387 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-di/references/di-patterns.md +519 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-directives/SKILL.md +437 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-directives/references/directive-patterns.md +570 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-forms/SKILL.md +434 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-forms/references/form-patterns.md +398 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-http/SKILL.md +366 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-http/references/http-patterns.md +448 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-routing/SKILL.md +395 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-routing/references/routing-patterns.md +472 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-signals/SKILL.md +302 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-signals/references/signal-patterns.md +404 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-ssr/SKILL.md +435 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-ssr/references/ssr-patterns.md +497 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-testing/SKILL.md +660 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-testing/references/testing-patterns.md +707 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-tooling/SKILL.md +352 -0
- package/templates/frontend/angular-base/.cursor/skills/angular-tooling/references/tooling-patterns.md +448 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-accessibility/SKILL.md +780 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-components/SKILL.md +718 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-design-systems/SKILL.md +612 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-layouts/SKILL.md +594 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-animations/SKILL.md +432 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-animations/references/animation-patterns.md +427 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-debugging/SKILL.md +354 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-debugging/references/troubleshooting-guide.md +306 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-framework-integration/SKILL.md +578 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-framework-integration/references/react-patterns.md +353 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/SKILL.md +608 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/references/advanced-theme-patterns.md +215 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/references/custom-utilities-guide.md +281 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-mobile-first/SKILL.md +768 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-performance/SKILL.md +374 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-performance/references/bundle-optimization.md +244 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-plugins/SKILL.md +505 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-responsive-darkmode/SKILL.md +601 -0
- package/templates/frontend/angular-base/.cursor/skills/tailwindcss-responsive-darkmode/references/advanced-responsive-patterns.md +485 -0
- package/templates/frontend/angular-base/.cursor/skills/web-design-guidelines/SKILL.md +39 -0
- package/templates/frontend/angular-base/package.json +0 -1
- package/templates/frontend/angular-base/pnpm-lock.yaml +8183 -0
- package/templates/frontend/angular-base/package-lock.json +0 -13321
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tailwindcss-debugging
|
|
3
|
+
description: Tailwind CSS debugging and troubleshooting guide for common issues and solutions
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Tailwind CSS Debugging & Troubleshooting
|
|
7
|
+
|
|
8
|
+
## Common Issues & Solutions
|
|
9
|
+
|
|
10
|
+
### 1. Styles Not Applying
|
|
11
|
+
|
|
12
|
+
#### Check Content Detection
|
|
13
|
+
|
|
14
|
+
v4 automatically detects content, but if styles are missing:
|
|
15
|
+
|
|
16
|
+
```css
|
|
17
|
+
/* Explicitly specify sources */
|
|
18
|
+
@import "tailwindcss";
|
|
19
|
+
@source "./src/**/*.{html,js,jsx,ts,tsx,vue,svelte}";
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
#### Verify Class Names
|
|
23
|
+
|
|
24
|
+
```html
|
|
25
|
+
<!-- WRONG - Dynamic class won't be detected -->
|
|
26
|
+
<div class={`text-${color}-500`}>
|
|
27
|
+
|
|
28
|
+
<!-- CORRECT - Use complete class names -->
|
|
29
|
+
<div class={color === 'blue' ? 'text-blue-500' : 'text-red-500'}>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
#### Check Build Process
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# Restart dev server
|
|
36
|
+
npm run dev
|
|
37
|
+
|
|
38
|
+
# Clear cache and rebuild
|
|
39
|
+
rm -rf node_modules/.vite
|
|
40
|
+
npm run build
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### 2. v4 Migration Issues
|
|
44
|
+
|
|
45
|
+
#### PostCSS Plugin Changed
|
|
46
|
+
|
|
47
|
+
```javascript
|
|
48
|
+
// OLD (v3)
|
|
49
|
+
export default {
|
|
50
|
+
plugins: {
|
|
51
|
+
tailwindcss: {},
|
|
52
|
+
autoprefixer: {}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// NEW (v4)
|
|
57
|
+
export default {
|
|
58
|
+
plugins: {
|
|
59
|
+
'@tailwindcss/postcss': {}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
#### Configuration Moved to CSS
|
|
65
|
+
|
|
66
|
+
```css
|
|
67
|
+
/* v4 - Configure in CSS, not JS */
|
|
68
|
+
@import "tailwindcss";
|
|
69
|
+
|
|
70
|
+
@theme {
|
|
71
|
+
--color-primary: oklch(0.6 0.2 250);
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
#### Dark Mode Variant
|
|
76
|
+
|
|
77
|
+
```css
|
|
78
|
+
/* v4 - Add if using selector strategy */
|
|
79
|
+
@custom-variant dark (&:where(.dark, .dark *));
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### 3. Classes Being Overridden
|
|
83
|
+
|
|
84
|
+
#### Check Specificity
|
|
85
|
+
|
|
86
|
+
```css
|
|
87
|
+
/* Browser DevTools: Inspect element → Styles panel */
|
|
88
|
+
/* Look for crossed-out styles */
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
#### Solutions
|
|
92
|
+
|
|
93
|
+
```html
|
|
94
|
+
<!-- Use !important (last resort) -->
|
|
95
|
+
<div class="!mt-0">
|
|
96
|
+
|
|
97
|
+
<!-- Or increase specificity with variants -->
|
|
98
|
+
<div class="[&]:mt-0">
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
#### Check Import Order
|
|
102
|
+
|
|
103
|
+
```css
|
|
104
|
+
/* Your custom CSS should come after Tailwind */
|
|
105
|
+
@import "tailwindcss";
|
|
106
|
+
@import "./custom.css"; /* After Tailwind */
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### 4. Typography Plugin Issues
|
|
110
|
+
|
|
111
|
+
#### Styles Not Applied
|
|
112
|
+
|
|
113
|
+
```css
|
|
114
|
+
/* Ensure plugin is loaded */
|
|
115
|
+
@plugin "@tailwindcss/typography";
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
#### Utilities Overridden by Prose
|
|
119
|
+
|
|
120
|
+
```html
|
|
121
|
+
<!-- Use element modifiers -->
|
|
122
|
+
<article class="prose prose-h1:text-4xl prose-a:text-blue-600">
|
|
123
|
+
|
|
124
|
+
<!-- Or escape prose entirely -->
|
|
125
|
+
<article class="prose">
|
|
126
|
+
<div class="not-prose">
|
|
127
|
+
<CustomComponent />
|
|
128
|
+
</div>
|
|
129
|
+
</article>
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### 5. Forms Plugin Issues
|
|
133
|
+
|
|
134
|
+
#### Styles Not Applied to Plain Inputs
|
|
135
|
+
|
|
136
|
+
```html
|
|
137
|
+
<!-- Forms plugin only styles inputs with type attribute -->
|
|
138
|
+
<input type="text" /> <!-- ✓ Styled -->
|
|
139
|
+
<input /> <!-- ✗ Not styled -->
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
#### Using Class Strategy
|
|
143
|
+
|
|
144
|
+
```css
|
|
145
|
+
@plugin "@tailwindcss/forms" {
|
|
146
|
+
strategy: class;
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
```html
|
|
151
|
+
<!-- Now explicitly opt-in -->
|
|
152
|
+
<input type="text" class="form-input" />
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Debugging Tools
|
|
156
|
+
|
|
157
|
+
### VS Code Extension
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
# Install Tailwind CSS IntelliSense
|
|
161
|
+
code --install-extension bradlc.vscode-tailwindcss
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Features:
|
|
165
|
+
- Autocomplete for class names
|
|
166
|
+
- Hover previews showing CSS
|
|
167
|
+
- Linting for errors
|
|
168
|
+
- Color decorators
|
|
169
|
+
|
|
170
|
+
### Debug Screens Plugin
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
npm install -D @tailwindcss/debug-screens
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
```css
|
|
177
|
+
@plugin "@tailwindcss/debug-screens";
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
```html
|
|
181
|
+
<!-- Shows current breakpoint in corner -->
|
|
182
|
+
<body class="debug-screens">
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Browser DevTools
|
|
186
|
+
|
|
187
|
+
1. **Inspect Element** → See computed styles
|
|
188
|
+
2. **Styles Panel** → See which rules apply
|
|
189
|
+
3. **Filter** → Search for Tailwind classes
|
|
190
|
+
4. **Computed Tab** → See final computed values
|
|
191
|
+
|
|
192
|
+
### Check Generated CSS
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
# Output CSS to file for inspection
|
|
196
|
+
npx tailwindcss -o output.css --content './src/**/*.{html,js}'
|
|
197
|
+
|
|
198
|
+
# With verbose logging
|
|
199
|
+
DEBUG=tailwindcss:* npm run build
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## v4 Specific Debugging
|
|
203
|
+
|
|
204
|
+
### Check Plugin Loading
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
# Look for plugin-related errors
|
|
208
|
+
npm run build 2>&1 | grep -i plugin
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### Verify CSS Variable Output
|
|
212
|
+
|
|
213
|
+
```css
|
|
214
|
+
/* In browser DevTools, check :root for variables */
|
|
215
|
+
:root {
|
|
216
|
+
--color-blue-500: oklch(...);
|
|
217
|
+
--spacing-4: 1rem;
|
|
218
|
+
}
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Content Detection Issues
|
|
222
|
+
|
|
223
|
+
```css
|
|
224
|
+
/* Add explicit sources if auto-detection fails */
|
|
225
|
+
@source "./src/**/*.tsx";
|
|
226
|
+
@source "./components/**/*.tsx";
|
|
227
|
+
|
|
228
|
+
/* Exclude paths */
|
|
229
|
+
@source not "./src/generated/**";
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## Common Error Messages
|
|
233
|
+
|
|
234
|
+
### "Cannot find module '@tailwindcss/postcss'"
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
npm install -D @tailwindcss/postcss
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
### "Unknown at-rule @theme"
|
|
241
|
+
|
|
242
|
+
Using v3 tooling with v4 syntax. Update your build setup:
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
npm install -D tailwindcss@latest @tailwindcss/postcss@latest
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### "Class 'X' doesn't exist"
|
|
249
|
+
|
|
250
|
+
Dynamic class generation issue:
|
|
251
|
+
|
|
252
|
+
```javascript
|
|
253
|
+
// BAD
|
|
254
|
+
const classes = `bg-${dynamic}-500`
|
|
255
|
+
|
|
256
|
+
// GOOD
|
|
257
|
+
const colorMap = {
|
|
258
|
+
primary: 'bg-blue-500',
|
|
259
|
+
danger: 'bg-red-500'
|
|
260
|
+
}
|
|
261
|
+
const classes = colorMap[dynamic]
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
### "Styles not updating in development"
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
# Restart dev server
|
|
268
|
+
npm run dev
|
|
269
|
+
|
|
270
|
+
# Clear Vite cache
|
|
271
|
+
rm -rf node_modules/.vite
|
|
272
|
+
|
|
273
|
+
# Clear Next.js cache
|
|
274
|
+
rm -rf .next
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
## Performance Debugging
|
|
278
|
+
|
|
279
|
+
### Large CSS Output
|
|
280
|
+
|
|
281
|
+
```bash
|
|
282
|
+
# Check CSS file size
|
|
283
|
+
ls -lh dist/assets/*.css
|
|
284
|
+
|
|
285
|
+
# If too large, check for:
|
|
286
|
+
# 1. Dynamic class generation
|
|
287
|
+
# 2. Unnecessary safelisting
|
|
288
|
+
# 3. Unused plugins
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
### Slow Builds
|
|
292
|
+
|
|
293
|
+
```bash
|
|
294
|
+
# Time the build
|
|
295
|
+
time npm run build
|
|
296
|
+
|
|
297
|
+
# v4 should be very fast
|
|
298
|
+
# Full build: <1s
|
|
299
|
+
# Incremental: microseconds
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
## Debugging Checklist
|
|
303
|
+
|
|
304
|
+
### Initial Setup
|
|
305
|
+
|
|
306
|
+
- [ ] Correct import: `@import "tailwindcss";`
|
|
307
|
+
- [ ] PostCSS plugin: `@tailwindcss/postcss` (not `tailwindcss`)
|
|
308
|
+
- [ ] Vite plugin: `@tailwindcss/vite` (if using Vite)
|
|
309
|
+
- [ ] CSS file imported in entry point
|
|
310
|
+
- [ ] Development server restarted after changes
|
|
311
|
+
|
|
312
|
+
### Styles Not Applying
|
|
313
|
+
|
|
314
|
+
- [ ] Class name is complete (no dynamic generation)
|
|
315
|
+
- [ ] File is in content path
|
|
316
|
+
- [ ] Browser cache cleared
|
|
317
|
+
- [ ] No CSS specificity conflicts
|
|
318
|
+
- [ ] Check DevTools for overridden styles
|
|
319
|
+
|
|
320
|
+
### After Migration
|
|
321
|
+
|
|
322
|
+
- [ ] tailwind.config.js removed or converted
|
|
323
|
+
- [ ] @theme directive used for customization
|
|
324
|
+
- [ ] PostCSS config updated
|
|
325
|
+
- [ ] Dark mode variant added if using selector strategy
|
|
326
|
+
- [ ] Plugins updated to v4-compatible versions
|
|
327
|
+
|
|
328
|
+
### Production Issues
|
|
329
|
+
|
|
330
|
+
- [ ] NODE_ENV=production
|
|
331
|
+
- [ ] Build output includes styles
|
|
332
|
+
- [ ] CSS file linked correctly
|
|
333
|
+
- [ ] No dynamic class generation issues
|
|
334
|
+
|
|
335
|
+
## Getting Help
|
|
336
|
+
|
|
337
|
+
### Create Minimal Reproduction
|
|
338
|
+
|
|
339
|
+
```bash
|
|
340
|
+
# Create fresh project
|
|
341
|
+
npm create vite@latest repro -- --template react-ts
|
|
342
|
+
cd repro
|
|
343
|
+
npm install -D tailwindcss @tailwindcss/vite
|
|
344
|
+
|
|
345
|
+
# Add minimal code that shows the issue
|
|
346
|
+
# Share on GitHub Issues or Discord
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
### Resources
|
|
350
|
+
|
|
351
|
+
- [Official Docs](https://tailwindcss.com/docs)
|
|
352
|
+
- [GitHub Issues](https://github.com/tailwindlabs/tailwindcss/issues)
|
|
353
|
+
- [Tailwind CSS Discord](https://tailwindcss.com/discord)
|
|
354
|
+
- [Stack Overflow](https://stackoverflow.com/questions/tagged/tailwind-css)
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
# Tailwind CSS Troubleshooting Guide
|
|
2
|
+
|
|
3
|
+
## Classes Not Working
|
|
4
|
+
|
|
5
|
+
### Symptom: Utility class has no effect
|
|
6
|
+
|
|
7
|
+
**1. Dynamic Class Names**
|
|
8
|
+
|
|
9
|
+
Most common issue. Tailwind can't detect dynamically constructed classes:
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
// WON'T WORK
|
|
13
|
+
const color = 'blue'
|
|
14
|
+
className={`bg-${color}-500`} // ❌
|
|
15
|
+
|
|
16
|
+
// WORKS
|
|
17
|
+
const bgColors = {
|
|
18
|
+
blue: 'bg-blue-500',
|
|
19
|
+
red: 'bg-red-500',
|
|
20
|
+
}
|
|
21
|
+
className={bgColors[color]} // ✓
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**2. Content Detection Failure**
|
|
25
|
+
|
|
26
|
+
v4 auto-detects files, but may miss custom locations:
|
|
27
|
+
|
|
28
|
+
```css
|
|
29
|
+
/* Add explicit source paths */
|
|
30
|
+
@import "tailwindcss";
|
|
31
|
+
@source "../custom-components/**/*.tsx";
|
|
32
|
+
@source "../../shared-ui/**/*.jsx";
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**3. CSS Specificity Conflict**
|
|
36
|
+
|
|
37
|
+
Check browser DevTools for overridden styles:
|
|
38
|
+
- Look for crossed-out declarations
|
|
39
|
+
- Check for `!important` rules
|
|
40
|
+
- Look for more specific selectors (IDs, inline styles)
|
|
41
|
+
|
|
42
|
+
Fix: Use `!important` modifier or restructure CSS:
|
|
43
|
+
```html
|
|
44
|
+
<div class="!mt-0">Forces margin-top: 0</div>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**4. Cache Issues**
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# Clear all caches
|
|
51
|
+
rm -rf node_modules/.cache .next/cache .vite
|
|
52
|
+
|
|
53
|
+
# Restart dev server
|
|
54
|
+
npm run dev
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**5. Build Not Running**
|
|
58
|
+
|
|
59
|
+
Verify Tailwind is processing your CSS:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
# Check for tailwind in output
|
|
63
|
+
grep "bg-blue-500" dist/output.css
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Dark Mode Not Working
|
|
67
|
+
|
|
68
|
+
### Symptom: `dark:` variants have no effect
|
|
69
|
+
|
|
70
|
+
**1. Missing dark mode configuration**
|
|
71
|
+
|
|
72
|
+
```css
|
|
73
|
+
/* globals.css */
|
|
74
|
+
@import "tailwindcss";
|
|
75
|
+
@custom-variant dark (&:where(.dark, .dark *));
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**2. `dark` class not on html/body**
|
|
79
|
+
|
|
80
|
+
```html
|
|
81
|
+
<html class="dark"> <!-- Required for selector strategy -->
|
|
82
|
+
<body>...</body>
|
|
83
|
+
</html>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**3. Using wrong strategy**
|
|
87
|
+
|
|
88
|
+
```css
|
|
89
|
+
/* For media query strategy (prefers-color-scheme) */
|
|
90
|
+
@custom-variant dark (media(prefers-color-scheme: dark));
|
|
91
|
+
|
|
92
|
+
/* For selector strategy (class-based) */
|
|
93
|
+
@custom-variant dark (&:where(.dark, .dark *));
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Responsive Breakpoints Not Working
|
|
97
|
+
|
|
98
|
+
### Symptom: `sm:`, `md:`, etc. have no effect
|
|
99
|
+
|
|
100
|
+
**1. Viewport too small**
|
|
101
|
+
|
|
102
|
+
Remember breakpoints are mobile-first (min-width):
|
|
103
|
+
|
|
104
|
+
| Prefix | Min-width |
|
|
105
|
+
|--------|-----------|
|
|
106
|
+
| `sm:` | 640px |
|
|
107
|
+
| `md:` | 768px |
|
|
108
|
+
| `lg:` | 1024px |
|
|
109
|
+
| `xl:` | 1280px |
|
|
110
|
+
|
|
111
|
+
**2. Parent container constraining width**
|
|
112
|
+
|
|
113
|
+
```html
|
|
114
|
+
<!-- Parent might limit width -->
|
|
115
|
+
<div class="max-w-sm">
|
|
116
|
+
<div class="md:flex"><!-- md: won't trigger if parent is narrow --></div>
|
|
117
|
+
</div>
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
**3. Browser zoom affecting viewport**
|
|
121
|
+
|
|
122
|
+
Reset zoom to 100% for accurate testing.
|
|
123
|
+
|
|
124
|
+
## PostCSS / Build Errors
|
|
125
|
+
|
|
126
|
+
### "Unknown at-rule @import"
|
|
127
|
+
|
|
128
|
+
Missing PostCSS configuration:
|
|
129
|
+
|
|
130
|
+
```javascript
|
|
131
|
+
// postcss.config.mjs
|
|
132
|
+
export default {
|
|
133
|
+
plugins: {
|
|
134
|
+
'@tailwindcss/postcss': {},
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### "Cannot find module 'tailwindcss'"
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
npm install -D tailwindcss @tailwindcss/postcss
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Vite-specific errors
|
|
146
|
+
|
|
147
|
+
```javascript
|
|
148
|
+
// vite.config.js
|
|
149
|
+
import tailwindcss from '@tailwindcss/vite'
|
|
150
|
+
|
|
151
|
+
export default defineConfig({
|
|
152
|
+
plugins: [tailwindcss()], // Must be in plugins
|
|
153
|
+
})
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## IntelliSense Not Working
|
|
157
|
+
|
|
158
|
+
### VS Code autocomplete missing
|
|
159
|
+
|
|
160
|
+
**1. Install extension**
|
|
161
|
+
```bash
|
|
162
|
+
code --install-extension bradlc.vscode-tailwindcss
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
**2. Configure for custom locations**
|
|
166
|
+
|
|
167
|
+
```json
|
|
168
|
+
// .vscode/settings.json
|
|
169
|
+
{
|
|
170
|
+
"tailwindCSS.includeLanguages": {
|
|
171
|
+
"typescript": "javascript",
|
|
172
|
+
"typescriptreact": "javascript"
|
|
173
|
+
},
|
|
174
|
+
"tailwindCSS.experimental.classRegex": [
|
|
175
|
+
["clsx\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"],
|
|
176
|
+
["cn\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"],
|
|
177
|
+
["cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"]
|
|
178
|
+
]
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
**3. Restart extension**
|
|
183
|
+
- Cmd/Ctrl + Shift + P
|
|
184
|
+
- "Tailwind CSS: Reload Extension"
|
|
185
|
+
|
|
186
|
+
## Performance Issues
|
|
187
|
+
|
|
188
|
+
### Slow builds
|
|
189
|
+
|
|
190
|
+
**1. Too many files in content scan**
|
|
191
|
+
|
|
192
|
+
```css
|
|
193
|
+
/* Be specific with @source */
|
|
194
|
+
@source "./src/**/*.{tsx,jsx}";
|
|
195
|
+
@source not "./src/**/*.test.tsx";
|
|
196
|
+
@source not "./node_modules/**";
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
**2. Large safelist**
|
|
200
|
+
|
|
201
|
+
Minimize or remove safelist:
|
|
202
|
+
```css
|
|
203
|
+
/* Avoid large safelists */
|
|
204
|
+
@source inline("bg-red-500 bg-blue-500"); /* Only when necessary */
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Large CSS output
|
|
208
|
+
|
|
209
|
+
**1. Check for dynamic class patterns**
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
# Find potential issues
|
|
213
|
+
grep -r "bg-\${" src/ --include="*.tsx"
|
|
214
|
+
grep -r "text-\${" src/ --include="*.tsx"
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
**2. Analyze output**
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
# Check CSS size
|
|
221
|
+
ls -lh dist/assets/*.css
|
|
222
|
+
|
|
223
|
+
# Count selectors
|
|
224
|
+
grep -o '\.[a-zA-Z]' dist/output.css | wc -l
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
## Common Migration Issues (v3 → v4)
|
|
228
|
+
|
|
229
|
+
### Border color changed
|
|
230
|
+
|
|
231
|
+
```css
|
|
232
|
+
/* v3: border used gray-200 by default */
|
|
233
|
+
/* v4: border uses currentColor */
|
|
234
|
+
|
|
235
|
+
/* Fix: Set explicit color */
|
|
236
|
+
.legacy-borders {
|
|
237
|
+
@apply border-gray-200;
|
|
238
|
+
}
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### Ring defaults changed
|
|
242
|
+
|
|
243
|
+
```css
|
|
244
|
+
/* v3: ring was 3px blue-500 */
|
|
245
|
+
/* v4: ring is 1px currentColor */
|
|
246
|
+
|
|
247
|
+
/* Fix: Be explicit */
|
|
248
|
+
@theme {
|
|
249
|
+
--default-ring-width: 3px;
|
|
250
|
+
--default-ring-color: var(--color-blue-500);
|
|
251
|
+
}
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### theme() function deprecated
|
|
255
|
+
|
|
256
|
+
```css
|
|
257
|
+
/* v3 */
|
|
258
|
+
.element {
|
|
259
|
+
background: theme(colors.blue.500);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/* v4 */
|
|
263
|
+
.element {
|
|
264
|
+
background: var(--color-blue-500);
|
|
265
|
+
}
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
## Debugging Checklist
|
|
269
|
+
|
|
270
|
+
### Quick Verification
|
|
271
|
+
|
|
272
|
+
Add this test element to any page:
|
|
273
|
+
|
|
274
|
+
```html
|
|
275
|
+
<div class="bg-red-500 p-4 text-white fixed top-0 right-0 z-50">
|
|
276
|
+
Tailwind Working
|
|
277
|
+
</div>
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### Full Debug Steps
|
|
281
|
+
|
|
282
|
+
1. ✓ Check browser DevTools for the class
|
|
283
|
+
2. ✓ Search compiled CSS for the class name
|
|
284
|
+
3. ✓ Verify PostCSS config exists
|
|
285
|
+
4. ✓ Check for dynamic class name issues
|
|
286
|
+
5. ✓ Clear caches and restart
|
|
287
|
+
6. ✓ Check console for errors
|
|
288
|
+
7. ✓ Verify file is in content detection path
|
|
289
|
+
8. ✓ Check for CSS specificity conflicts
|
|
290
|
+
|
|
291
|
+
### Browser DevTools
|
|
292
|
+
|
|
293
|
+
```
|
|
294
|
+
1. Right-click element → Inspect
|
|
295
|
+
2. Check "Styles" panel for your class
|
|
296
|
+
3. If present but crossed out → specificity issue
|
|
297
|
+
4. If missing → content detection or build issue
|
|
298
|
+
5. Check "Computed" panel for final values
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
### Verbose Build Output
|
|
302
|
+
|
|
303
|
+
```bash
|
|
304
|
+
# See what Tailwind is processing
|
|
305
|
+
DEBUG=tailwindcss:* npm run build
|
|
306
|
+
```
|