create-huenei-template 0.2.2 → 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.
Files changed (87) hide show
  1. package/dist/config/templates.js +3 -3
  2. package/dist/templates/frontend/angular-base/.cursor/skills/angular-component/SKILL.md +288 -0
  3. package/dist/templates/frontend/angular-base/.cursor/skills/angular-component/references/component-patterns.md +358 -0
  4. package/dist/templates/frontend/angular-base/.cursor/skills/angular-di/SKILL.md +387 -0
  5. package/dist/templates/frontend/angular-base/.cursor/skills/angular-di/references/di-patterns.md +519 -0
  6. package/dist/templates/frontend/angular-base/.cursor/skills/angular-directives/SKILL.md +437 -0
  7. package/dist/templates/frontend/angular-base/.cursor/skills/angular-directives/references/directive-patterns.md +570 -0
  8. package/dist/templates/frontend/angular-base/.cursor/skills/angular-forms/SKILL.md +434 -0
  9. package/dist/templates/frontend/angular-base/.cursor/skills/angular-forms/references/form-patterns.md +398 -0
  10. package/dist/templates/frontend/angular-base/.cursor/skills/angular-http/SKILL.md +366 -0
  11. package/dist/templates/frontend/angular-base/.cursor/skills/angular-http/references/http-patterns.md +448 -0
  12. package/dist/templates/frontend/angular-base/.cursor/skills/angular-routing/SKILL.md +395 -0
  13. package/dist/templates/frontend/angular-base/.cursor/skills/angular-routing/references/routing-patterns.md +472 -0
  14. package/dist/templates/frontend/angular-base/.cursor/skills/angular-signals/SKILL.md +302 -0
  15. package/dist/templates/frontend/angular-base/.cursor/skills/angular-signals/references/signal-patterns.md +404 -0
  16. package/dist/templates/frontend/angular-base/.cursor/skills/angular-ssr/SKILL.md +435 -0
  17. package/dist/templates/frontend/angular-base/.cursor/skills/angular-ssr/references/ssr-patterns.md +497 -0
  18. package/dist/templates/frontend/angular-base/.cursor/skills/angular-testing/SKILL.md +660 -0
  19. package/dist/templates/frontend/angular-base/.cursor/skills/angular-testing/references/testing-patterns.md +707 -0
  20. package/dist/templates/frontend/angular-base/.cursor/skills/angular-tooling/SKILL.md +352 -0
  21. package/dist/templates/frontend/angular-base/.cursor/skills/angular-tooling/references/tooling-patterns.md +448 -0
  22. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-accessibility/SKILL.md +780 -0
  23. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-components/SKILL.md +718 -0
  24. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-design-systems/SKILL.md +612 -0
  25. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-layouts/SKILL.md +594 -0
  26. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-animations/SKILL.md +432 -0
  27. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-animations/references/animation-patterns.md +427 -0
  28. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-debugging/SKILL.md +354 -0
  29. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-debugging/references/troubleshooting-guide.md +306 -0
  30. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-framework-integration/SKILL.md +578 -0
  31. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-framework-integration/references/react-patterns.md +353 -0
  32. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/SKILL.md +608 -0
  33. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/references/advanced-theme-patterns.md +215 -0
  34. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/references/custom-utilities-guide.md +281 -0
  35. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-mobile-first/SKILL.md +768 -0
  36. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-performance/SKILL.md +374 -0
  37. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-performance/references/bundle-optimization.md +244 -0
  38. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-plugins/SKILL.md +505 -0
  39. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-responsive-darkmode/SKILL.md +601 -0
  40. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-responsive-darkmode/references/advanced-responsive-patterns.md +485 -0
  41. package/dist/templates/frontend/angular-base/.cursor/skills/web-design-guidelines/SKILL.md +39 -0
  42. package/dist/templates/frontend/angular-base/package.json +0 -1
  43. package/dist/templates/frontend/angular-base/pnpm-lock.yaml +8183 -0
  44. package/package.json +1 -1
  45. package/templates/frontend/angular-base/.cursor/skills/angular-component/SKILL.md +288 -0
  46. package/templates/frontend/angular-base/.cursor/skills/angular-component/references/component-patterns.md +358 -0
  47. package/templates/frontend/angular-base/.cursor/skills/angular-di/SKILL.md +387 -0
  48. package/templates/frontend/angular-base/.cursor/skills/angular-di/references/di-patterns.md +519 -0
  49. package/templates/frontend/angular-base/.cursor/skills/angular-directives/SKILL.md +437 -0
  50. package/templates/frontend/angular-base/.cursor/skills/angular-directives/references/directive-patterns.md +570 -0
  51. package/templates/frontend/angular-base/.cursor/skills/angular-forms/SKILL.md +434 -0
  52. package/templates/frontend/angular-base/.cursor/skills/angular-forms/references/form-patterns.md +398 -0
  53. package/templates/frontend/angular-base/.cursor/skills/angular-http/SKILL.md +366 -0
  54. package/templates/frontend/angular-base/.cursor/skills/angular-http/references/http-patterns.md +448 -0
  55. package/templates/frontend/angular-base/.cursor/skills/angular-routing/SKILL.md +395 -0
  56. package/templates/frontend/angular-base/.cursor/skills/angular-routing/references/routing-patterns.md +472 -0
  57. package/templates/frontend/angular-base/.cursor/skills/angular-signals/SKILL.md +302 -0
  58. package/templates/frontend/angular-base/.cursor/skills/angular-signals/references/signal-patterns.md +404 -0
  59. package/templates/frontend/angular-base/.cursor/skills/angular-ssr/SKILL.md +435 -0
  60. package/templates/frontend/angular-base/.cursor/skills/angular-ssr/references/ssr-patterns.md +497 -0
  61. package/templates/frontend/angular-base/.cursor/skills/angular-testing/SKILL.md +660 -0
  62. package/templates/frontend/angular-base/.cursor/skills/angular-testing/references/testing-patterns.md +707 -0
  63. package/templates/frontend/angular-base/.cursor/skills/angular-tooling/SKILL.md +352 -0
  64. package/templates/frontend/angular-base/.cursor/skills/angular-tooling/references/tooling-patterns.md +448 -0
  65. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-accessibility/SKILL.md +780 -0
  66. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-components/SKILL.md +718 -0
  67. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-design-systems/SKILL.md +612 -0
  68. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-layouts/SKILL.md +594 -0
  69. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-animations/SKILL.md +432 -0
  70. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-animations/references/animation-patterns.md +427 -0
  71. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-debugging/SKILL.md +354 -0
  72. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-debugging/references/troubleshooting-guide.md +306 -0
  73. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-framework-integration/SKILL.md +578 -0
  74. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-framework-integration/references/react-patterns.md +353 -0
  75. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/SKILL.md +608 -0
  76. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/references/advanced-theme-patterns.md +215 -0
  77. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/references/custom-utilities-guide.md +281 -0
  78. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-mobile-first/SKILL.md +768 -0
  79. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-performance/SKILL.md +374 -0
  80. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-performance/references/bundle-optimization.md +244 -0
  81. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-plugins/SKILL.md +505 -0
  82. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-responsive-darkmode/SKILL.md +601 -0
  83. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-responsive-darkmode/references/advanced-responsive-patterns.md +485 -0
  84. package/templates/frontend/angular-base/.cursor/skills/web-design-guidelines/SKILL.md +39 -0
  85. package/templates/frontend/angular-base/package.json +0 -1
  86. package/templates/frontend/angular-base/pnpm-lock.yaml +8183 -0
  87. package/templates/frontend/angular-base/package-lock.json +0 -13321
@@ -0,0 +1,374 @@
1
+ ---
2
+ name: tailwindcss-performance
3
+ description: Tailwind CSS performance optimization including v4 improvements and best practices
4
+ ---
5
+
6
+ # Tailwind CSS Performance Optimization
7
+
8
+ ## v4 Performance Improvements
9
+
10
+ Tailwind CSS v4 features a completely rewritten engine in Rust:
11
+
12
+ | Metric | v3 | v4 |
13
+ |--------|----|----|
14
+ | Full builds | Baseline | Up to 5x faster |
15
+ | Incremental builds | Milliseconds | Microseconds (100x+) |
16
+ | Engine | JavaScript | Rust |
17
+
18
+ ## JIT (Just-In-Time) Compilation
19
+
20
+ ### How JIT Works
21
+
22
+ JIT generates styles on-demand as classes are discovered in your files:
23
+
24
+ 1. Scans source files for class names
25
+ 2. Generates only the CSS you use
26
+ 3. Produces minimal, optimized output
27
+
28
+ ### v4: Always JIT
29
+
30
+ Unlike v3, JIT is always enabled in v4—no configuration needed:
31
+
32
+ ```css
33
+ @import "tailwindcss";
34
+ /* JIT is automatic */
35
+ ```
36
+
37
+ ## Content Detection
38
+
39
+ ### Automatic Detection (v4)
40
+
41
+ v4 automatically detects template files—no content configuration required:
42
+
43
+ ```css
44
+ /* v4 - Works automatically */
45
+ @import "tailwindcss";
46
+ ```
47
+
48
+ ### Explicit Content (v4)
49
+
50
+ If automatic detection fails, specify sources explicitly:
51
+
52
+ ```css
53
+ @import "tailwindcss";
54
+ @source "./src/**/*.{html,js,jsx,ts,tsx,vue,svelte}";
55
+ @source "./components/**/*.{js,jsx,ts,tsx}";
56
+ ```
57
+
58
+ ### Excluding Paths
59
+
60
+ ```css
61
+ @source not "./src/legacy/**";
62
+ ```
63
+
64
+ ## Tree Shaking
65
+
66
+ ### How It Works
67
+
68
+ Tailwind's build process removes unused CSS:
69
+
70
+ ```
71
+ Source: All possible utilities (~15MB+)
72
+ ↓
73
+ Scan: Find used class names
74
+ ↓
75
+ Output: Only used styles (~10-50KB typical)
76
+ ```
77
+
78
+ ### Production Build
79
+
80
+ ```bash
81
+ # Vite - automatically optimized for production
82
+ npm run build
83
+
84
+ # PostCSS - ensure NODE_ENV is set
85
+ NODE_ENV=production npx postcss input.css -o output.css
86
+ ```
87
+
88
+ ## Dynamic Class Names
89
+
90
+ ### The Problem
91
+
92
+ Tailwind can't detect dynamically constructed class names:
93
+
94
+ ```javascript
95
+ // BAD - Classes won't be generated
96
+ const color = 'blue'
97
+ className={`text-${color}-500`} // ❌ Not detected
98
+
99
+ const size = 'lg'
100
+ className={`text-${size}`} // ❌ Not detected
101
+ ```
102
+
103
+ ### Solutions
104
+
105
+ #### 1. Use Complete Class Names
106
+
107
+ ```javascript
108
+ // GOOD - Full class names
109
+ const colorClasses = {
110
+ blue: 'text-blue-500',
111
+ red: 'text-red-500',
112
+ green: 'text-green-500',
113
+ }
114
+ className={colorClasses[color]} // ✓ Detected
115
+ ```
116
+
117
+ #### 2. Use Data Attributes
118
+
119
+ ```javascript
120
+ // GOOD - Style based on data attributes
121
+ <div data-color={color} className="data-[color=blue]:text-blue-500 data-[color=red]:text-red-500">
122
+ ```
123
+
124
+ #### 3. Safelist Classes
125
+
126
+ ```css
127
+ /* In your CSS for v4 */
128
+ @source inline("text-blue-500 text-red-500 text-green-500");
129
+ ```
130
+
131
+ #### 4. CSS Variables
132
+
133
+ ```css
134
+ @theme {
135
+ --color-dynamic: oklch(0.6 0.2 250);
136
+ }
137
+ ```
138
+
139
+ ```html
140
+ <div class="text-[var(--color-dynamic)]">Dynamic color</div>
141
+ ```
142
+
143
+ ## Optimizing Transitions
144
+
145
+ ### Use Specific Transitions
146
+
147
+ ```html
148
+ <!-- SLOW - Transitions all properties -->
149
+ <button class="transition-all duration-200">
150
+
151
+ <!-- FAST - Only transitions specific properties -->
152
+ <button class="transition-colors duration-200">
153
+ <button class="transition-transform duration-200">
154
+ <button class="transition-opacity duration-200">
155
+ ```
156
+
157
+ ### GPU-Accelerated Properties
158
+
159
+ Prefer `transform` and `opacity` for smooth animations:
160
+
161
+ ```html
162
+ <!-- GOOD - GPU accelerated -->
163
+ <div class="transform hover:scale-105 transition-transform">
164
+
165
+ <!-- GOOD - GPU accelerated -->
166
+ <div class="opacity-100 hover:opacity-80 transition-opacity">
167
+
168
+ <!-- SLOW - May cause repaints -->
169
+ <div class="left-0 hover:left-4 transition-all">
170
+ ```
171
+
172
+ ## CSS Variable Usage
173
+
174
+ ### Prefer Native Variables
175
+
176
+ In v4, use CSS variables directly instead of `theme()`:
177
+
178
+ ```css
179
+ /* v3 - Uses theme() function */
180
+ .element {
181
+ color: theme(colors.blue.500);
182
+ }
183
+
184
+ /* v4 - Use CSS variables (faster) */
185
+ .element {
186
+ color: var(--color-blue-500);
187
+ }
188
+ ```
189
+
190
+ ### Static Theme Values
191
+
192
+ For performance-critical paths:
193
+
194
+ ```css
195
+ @import "tailwindcss/theme.css" theme(static);
196
+ ```
197
+
198
+ This inlines theme values instead of using CSS variables.
199
+
200
+ ## Build Optimization
201
+
202
+ ### Vite Configuration
203
+
204
+ ```javascript
205
+ // vite.config.js
206
+ import tailwindcss from '@tailwindcss/vite'
207
+ import { defineConfig } from 'vite'
208
+
209
+ export default defineConfig({
210
+ plugins: [tailwindcss()],
211
+ build: {
212
+ // Minify CSS
213
+ cssMinify: 'lightningcss',
214
+ // Optimize chunks
215
+ rollupOptions: {
216
+ output: {
217
+ manualChunks: {
218
+ // Split vendor CSS if needed
219
+ }
220
+ }
221
+ }
222
+ }
223
+ })
224
+ ```
225
+
226
+ ### PostCSS with cssnano
227
+
228
+ ```javascript
229
+ // postcss.config.mjs
230
+ export default {
231
+ plugins: {
232
+ '@tailwindcss/postcss': {},
233
+ cssnano: process.env.NODE_ENV === 'production' ? {} : false
234
+ }
235
+ }
236
+ ```
237
+
238
+ ## Reducing Bundle Size
239
+
240
+ ### 1. Avoid Unused Plugins
241
+
242
+ ```css
243
+ /* Only load what you need */
244
+ @plugin "@tailwindcss/typography";
245
+ /* Don't load unused plugins */
246
+ ```
247
+
248
+ ### 2. Limit Color Palette
249
+
250
+ ```css
251
+ @theme {
252
+ /* Disable default colors */
253
+ --color-*: initial;
254
+
255
+ /* Define only needed colors */
256
+ --color-primary: oklch(0.6 0.2 250);
257
+ --color-secondary: oklch(0.7 0.15 180);
258
+ --color-gray-100: oklch(0.95 0 0);
259
+ --color-gray-900: oklch(0.15 0 0);
260
+ }
261
+ ```
262
+
263
+ ### 3. Limit Breakpoints
264
+
265
+ ```css
266
+ @theme {
267
+ /* Remove unused breakpoints */
268
+ --breakpoint-2xl: initial;
269
+
270
+ /* Keep only what you use */
271
+ --breakpoint-sm: 640px;
272
+ --breakpoint-md: 768px;
273
+ --breakpoint-lg: 1024px;
274
+ }
275
+ ```
276
+
277
+ ## Caching Strategies
278
+
279
+ ### Development
280
+
281
+ - v4's incremental builds are already extremely fast
282
+ - No additional caching needed in most cases
283
+
284
+ ### CI/CD
285
+
286
+ ```yaml
287
+ # GitHub Actions example
288
+ - name: Cache node_modules
289
+ uses: actions/cache@v4
290
+ with:
291
+ path: node_modules
292
+ key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
293
+
294
+ - name: Build
295
+ run: npm run build
296
+ ```
297
+
298
+ ## Measuring Performance
299
+
300
+ ### Build Time Analysis
301
+
302
+ ```bash
303
+ # Time your build
304
+ time npm run build
305
+
306
+ # Verbose output
307
+ DEBUG=tailwindcss:* npm run build
308
+ ```
309
+
310
+ ### Bundle Analysis
311
+
312
+ ```bash
313
+ # Install analyzer
314
+ npm install -D vite-bundle-analyzer
315
+
316
+ # Analyze bundle
317
+ npm run build -- --analyze
318
+ ```
319
+
320
+ ### CSS Size Check
321
+
322
+ ```bash
323
+ # Check output CSS size
324
+ ls -lh dist/assets/*.css
325
+
326
+ # Gzipped size
327
+ gzip -c dist/assets/main.css | wc -c
328
+ ```
329
+
330
+ ## Performance Checklist
331
+
332
+ ### Development
333
+
334
+ - [ ] JIT is working (styles update instantly)
335
+ - [ ] No console warnings about large files
336
+ - [ ] Hot reload is fast
337
+
338
+ ### Production
339
+
340
+ - [ ] `NODE_ENV=production` is set
341
+ - [ ] CSS is minified
342
+ - [ ] Unused CSS is removed
343
+ - [ ] No dynamic class name issues
344
+ - [ ] CSS size is reasonable (<50KB typical)
345
+
346
+ ### Common Issues
347
+
348
+ | Issue | Solution |
349
+ |-------|----------|
350
+ | Large CSS output | Check for dynamic classes, safelist issues |
351
+ | Slow builds | Ensure v4, check file globs |
352
+ | Missing styles | Check content detection, class names |
353
+ | Slow animations | Use GPU-accelerated properties |
354
+
355
+ ## Lazy Loading CSS
356
+
357
+ For very large apps, consider code-splitting CSS:
358
+
359
+ ```javascript
360
+ // Dynamically import CSS for routes
361
+ const AdminPage = lazy(() =>
362
+ import('./admin.css').then(() => import('./AdminPage'))
363
+ )
364
+ ```
365
+
366
+ ## Best Practices Summary
367
+
368
+ 1. **Let JIT do its work** - Don't safelist unnecessarily
369
+ 2. **Use complete class names** - Avoid dynamic concatenation
370
+ 3. **Specific transitions** - Not `transition-all`
371
+ 4. **GPU properties** - Prefer `transform` and `opacity`
372
+ 5. **Minimal theme** - Only define what you use
373
+ 6. **Production builds** - Always use production mode
374
+ 7. **Measure** - Check your actual CSS size
@@ -0,0 +1,244 @@
1
+ # Bundle Size Optimization
2
+
3
+ ## Measuring Your Bundle
4
+
5
+ ### Check Raw CSS Size
6
+
7
+ ```bash
8
+ # File size
9
+ ls -lh dist/assets/*.css
10
+
11
+ # Gzipped size (what users actually download)
12
+ gzip -c dist/assets/main.css | wc -c
13
+
14
+ # Brotli size (even smaller)
15
+ brotli -c dist/assets/main.css | wc -c
16
+ ```
17
+
18
+ ### Target Sizes
19
+
20
+ | App Type | Target CSS Size | Gzipped |
21
+ |----------|-----------------|---------|
22
+ | Landing page | < 15KB | < 5KB |
23
+ | Small app | < 30KB | < 10KB |
24
+ | Large app | < 50KB | < 15KB |
25
+ | Design system | < 80KB | < 25KB |
26
+
27
+ ## Reducing Theme Size
28
+
29
+ ### Minimal Color Palette
30
+
31
+ ```css
32
+ @theme {
33
+ /* Reset all defaults */
34
+ --color-*: initial;
35
+
36
+ /* Define only what you need */
37
+ --color-primary-500: oklch(0.55 0.2 250);
38
+ --color-primary-600: oklch(0.48 0.2 250);
39
+ --color-gray-50: oklch(0.98 0 0);
40
+ --color-gray-100: oklch(0.95 0 0);
41
+ --color-gray-500: oklch(0.55 0 0);
42
+ --color-gray-900: oklch(0.15 0 0);
43
+ --color-white: oklch(1 0 0);
44
+ --color-black: oklch(0 0 0);
45
+ }
46
+ ```
47
+
48
+ ### Limited Spacing Scale
49
+
50
+ ```css
51
+ @theme {
52
+ /* Reset defaults */
53
+ --spacing-*: initial;
54
+
55
+ /* 4px base scale */
56
+ --spacing-0: 0;
57
+ --spacing-1: 0.25rem; /* 4px */
58
+ --spacing-2: 0.5rem; /* 8px */
59
+ --spacing-3: 0.75rem; /* 12px */
60
+ --spacing-4: 1rem; /* 16px */
61
+ --spacing-6: 1.5rem; /* 24px */
62
+ --spacing-8: 2rem; /* 32px */
63
+ --spacing-12: 3rem; /* 48px */
64
+ --spacing-16: 4rem; /* 64px */
65
+ }
66
+ ```
67
+
68
+ ### Essential Breakpoints Only
69
+
70
+ ```css
71
+ @theme {
72
+ --breakpoint-*: initial;
73
+
74
+ /* Mobile-first essentials */
75
+ --breakpoint-sm: 640px; /* Tablet */
76
+ --breakpoint-lg: 1024px; /* Desktop */
77
+ /* Skip md, xl, 2xl if not using */
78
+ }
79
+ ```
80
+
81
+ ## Plugin Optimization
82
+
83
+ ### Load Only What You Need
84
+
85
+ ```css
86
+ /* Only load plugins you actually use */
87
+ @plugin "@tailwindcss/typography";
88
+
89
+ /* Don't load if not using */
90
+ /* @plugin "@tailwindcss/forms"; */
91
+ /* @plugin "@tailwindcss/container-queries"; */
92
+ ```
93
+
94
+ ### Typography Plugin Optimization
95
+
96
+ ```css
97
+ @plugin "@tailwindcss/typography" {
98
+ /* Use shorter class name */
99
+ className: prose;
100
+
101
+ /* Disable unused modifiers if needed */
102
+ /* modifiers: ["lg", "xl"]; */
103
+ }
104
+ ```
105
+
106
+ ## Static Theme Mode
107
+
108
+ For maximum performance when CSS variables aren't needed:
109
+
110
+ ```css
111
+ @import "tailwindcss/theme.css" theme(static);
112
+ @import "tailwindcss/utilities.css";
113
+ ```
114
+
115
+ This inlines all theme values instead of using CSS variables, resulting in:
116
+ - Smaller output (no variable declarations)
117
+ - Faster paint (no variable resolution)
118
+ - No dynamic theming capability
119
+
120
+ ## Code Splitting CSS
121
+
122
+ ### Route-Based Splitting
123
+
124
+ ```javascript
125
+ // vite.config.js
126
+ export default defineConfig({
127
+ build: {
128
+ rollupOptions: {
129
+ output: {
130
+ manualChunks(id) {
131
+ // Split CSS by route
132
+ if (id.includes('/admin/')) {
133
+ return 'admin'
134
+ }
135
+ if (id.includes('/dashboard/')) {
136
+ return 'dashboard'
137
+ }
138
+ }
139
+ }
140
+ }
141
+ }
142
+ })
143
+ ```
144
+
145
+ ### Lazy Load Feature CSS
146
+
147
+ ```tsx
148
+ // Only load when component mounts
149
+ const ChartComponent = lazy(async () => {
150
+ await import('./chart-styles.css')
151
+ return import('./Chart')
152
+ })
153
+ ```
154
+
155
+ ## Minification
156
+
157
+ ### Vite with LightningCSS
158
+
159
+ ```javascript
160
+ // vite.config.js
161
+ export default defineConfig({
162
+ css: {
163
+ transformer: 'lightningcss',
164
+ },
165
+ build: {
166
+ cssMinify: 'lightningcss',
167
+ }
168
+ })
169
+ ```
170
+
171
+ ### PostCSS with cssnano
172
+
173
+ ```javascript
174
+ // postcss.config.mjs
175
+ export default {
176
+ plugins: {
177
+ '@tailwindcss/postcss': {},
178
+ ...(process.env.NODE_ENV === 'production' ? {
179
+ cssnano: {
180
+ preset: ['default', {
181
+ discardComments: { removeAll: true },
182
+ normalizeWhitespace: true,
183
+ }]
184
+ }
185
+ } : {})
186
+ }
187
+ }
188
+ ```
189
+
190
+ ## Identifying Bloat
191
+
192
+ ### Find Large Selectors
193
+
194
+ ```bash
195
+ # Count unique selectors
196
+ grep -o '\.[a-zA-Z0-9_-]*' dist/output.css | sort -u | wc -l
197
+
198
+ # Find most repeated patterns
199
+ grep -o '\.[a-zA-Z0-9_-]*' dist/output.css | sort | uniq -c | sort -rn | head -20
200
+ ```
201
+
202
+ ### Check for Unused Classes
203
+
204
+ Use PurgeCSS in audit mode:
205
+
206
+ ```javascript
207
+ // purgecss.config.js
208
+ module.exports = {
209
+ content: ['./src/**/*.{tsx,jsx,html}'],
210
+ css: ['./dist/assets/*.css'],
211
+ output: './purgecss-report.json',
212
+ rejected: true, // Show what would be removed
213
+ }
214
+ ```
215
+
216
+ ### Bundle Analyzer
217
+
218
+ ```bash
219
+ # Install
220
+ npm install -D vite-bundle-visualizer
221
+
222
+ # Run
223
+ npx vite-bundle-visualizer
224
+ ```
225
+
226
+ ## Common Bloat Sources
227
+
228
+ | Issue | Solution |
229
+ |-------|----------|
230
+ | Full color palette | Use `--color-*: initial` and define only needed |
231
+ | All breakpoint variants | Limit breakpoints in theme |
232
+ | Unused plugins | Remove unused `@plugin` directives |
233
+ | Safe-listed classes | Review and minimize safelist |
234
+ | Dynamic class patterns | Use complete class names |
235
+
236
+ ## Production Checklist
237
+
238
+ - [ ] `NODE_ENV=production` is set
239
+ - [ ] CSS minification enabled
240
+ - [ ] Gzip/Brotli compression on server
241
+ - [ ] Theme limited to used tokens
242
+ - [ ] Only necessary plugins loaded
243
+ - [ ] No unnecessary safelist entries
244
+ - [ ] Bundle size within targets