eva-css-fluid 1.0.4 → 2.0.0

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/MIGRATION.md ADDED
@@ -0,0 +1,337 @@
1
+ # EVA CSS Migration Guide
2
+
3
+ This guide helps you migrate from your internal framework to EVA CSS.
4
+
5
+ ## Table of Contents
6
+
7
+ - [Quick Start](#quick-start)
8
+ - [Configuration Changes](#configuration-changes)
9
+ - [Common Gotchas](#common-gotchas)
10
+ - [Breaking Changes](#breaking-changes)
11
+ - [Migration Examples](#migration-examples)
12
+
13
+ ## Quick Start
14
+
15
+ ### Installation
16
+
17
+ ```bash
18
+ npm install eva-css-fluid
19
+ ```
20
+
21
+ ### Basic Setup
22
+
23
+ Replace your old framework import with EVA CSS:
24
+
25
+ ```scss
26
+ // Before (internal framework)
27
+ @import 'internal-framework/styles';
28
+
29
+ // After (EVA CSS)
30
+ @use 'eva-css-fluid/src' as *;
31
+ ```
32
+
33
+ ### With Custom Configuration
34
+
35
+ ```scss
36
+ @use 'eva-css-fluid/src' as * with (
37
+ $sizes: (4, 8, 12, 16, 24, 32, 48, 64, 96, 128),
38
+ $font-sizes: (12, 14, 16, 18, 20, 24, 32, 48)
39
+ );
40
+ ```
41
+
42
+ ## Configuration Changes
43
+
44
+ ### Required Base Size
45
+
46
+ **Important**: EVA CSS requires size `16` to be present in your `$sizes` configuration.
47
+
48
+ ```scss
49
+ // ❌ Will throw error
50
+ @use 'eva-css-fluid/src' as * with (
51
+ $sizes: (8, 24, 32, 64)
52
+ );
53
+
54
+ // ✅ Correct
55
+ @use 'eva-css-fluid/src' as * with (
56
+ $sizes: (8, 16, 24, 32, 64)
57
+ );
58
+ ```
59
+
60
+ **Why?** Size 16 (1rem) is used as the base unit for fluid calculations.
61
+
62
+ ### Configuration Options
63
+
64
+ | Option | Default | Description |
65
+ |--------|---------|-------------|
66
+ | `$sizes` | `4, 8, 12, 16, 24, 32, 48, 64, 96, 128` | Available size values (16 required) |
67
+ | `$font-sizes` | `12, 14, 16, 18, 20, 24, 32, 48` | Font size values |
68
+ | `$build-class` | `true` | Generate utility classes |
69
+ | `$px-rem-suffix` | `false` | Add px/rem debug values |
70
+ | `$name-by-size` | `true` | Use size values in names |
71
+ | `$custom-class` | `false` | Enable selective class generation |
72
+ | `$class-config` | `()` | Configure which classes to generate |
73
+
74
+ ## Common Gotchas
75
+
76
+ ### 1. Import Syntax Change
77
+
78
+ EVA CSS uses modern Sass `@use` instead of `@import`:
79
+
80
+ ```scss
81
+ // ❌ Old syntax (deprecated)
82
+ @import 'eva-css-fluid/src';
83
+
84
+ // ✅ New syntax
85
+ @use 'eva-css-fluid/src' as *;
86
+ ```
87
+
88
+ ### 2. Custom Class Mode
89
+
90
+ When using `$custom-class: true`, you **must** provide `$class-config`:
91
+
92
+ ```scss
93
+ // ❌ Will throw error
94
+ @use 'eva-css-fluid/src' as * with (
95
+ $custom-class: true
96
+ );
97
+
98
+ // ✅ Correct
99
+ @use 'eva-css-fluid/src' as * with (
100
+ $custom-class: true,
101
+ $class-config: (
102
+ w: (50, 100),
103
+ px: (24,), // Note: trailing comma for single-item lists
104
+ g: (24, 50)
105
+ )
106
+ );
107
+ ```
108
+
109
+ ### 3. Property Names in class-config
110
+
111
+ Only use valid property keys from the framework:
112
+
113
+ ```scss
114
+ // ❌ Invalid property
115
+ $class-config: (
116
+ width: (50, 100) // Use 'w' not 'width'
117
+ );
118
+
119
+ // ✅ Correct
120
+ $class-config: (
121
+ w: (50, 100)
122
+ );
123
+ ```
124
+
125
+ **Available properties**: `w`, `mw`, `h`, `p`, `px`, `pr`, `py`, `br`, `mb`, `mr`, `ml`, `mt`, `pt`, `pb`, `g`, `gap`
126
+
127
+ ### 4. Sizes Must Exist in $sizes
128
+
129
+ All sizes referenced in `$class-config` must exist in your `$sizes` list:
130
+
131
+ ```scss
132
+ // ❌ Will throw error (999 not in $sizes)
133
+ @use 'eva-css-fluid/src' as * with (
134
+ $sizes: (16, 24, 50, 100),
135
+ $custom-class: true,
136
+ $class-config: (
137
+ w: (50, 999)
138
+ )
139
+ );
140
+
141
+ // ✅ Correct
142
+ @use 'eva-css-fluid/src' as * with (
143
+ $sizes: (16, 24, 50, 100),
144
+ $custom-class: true,
145
+ $class-config: (
146
+ w: (50, 100)
147
+ )
148
+ );
149
+ ```
150
+
151
+ ## Breaking Changes
152
+
153
+ ### Version 1.1.0
154
+
155
+ #### Added
156
+
157
+ - **`$class-config` parameter**: New configuration option for custom class mode
158
+ - **Configuration validation**: Helpful error messages for invalid configurations
159
+ - **Required base size**: Size 16 is now required in `$sizes`
160
+
161
+ #### Changed
162
+
163
+ - `$custom-class` now requires `$class-config` to be set (if enabled)
164
+ - Empty `$sizes` or `$font-sizes` lists now throw errors
165
+
166
+ #### Migration Steps
167
+
168
+ 1. Ensure size `16` is in your `$sizes` configuration
169
+ 2. If using `$custom-class: true`, add `$class-config` parameter
170
+ 3. Test compilation to catch any validation errors
171
+
172
+ ## Migration Examples
173
+
174
+ ### Example 1: From Internal Framework
175
+
176
+ ```scss
177
+ // Before
178
+ @import 'internal-framework';
179
+
180
+ $spacing: 8px, 16px, 24px, 32px;
181
+ $colors: (
182
+ primary: #3498db,
183
+ secondary: #2ecc71
184
+ );
185
+
186
+ // After
187
+ @use 'eva-css-fluid/src' as * with (
188
+ $sizes: (8, 16, 24, 32)
189
+ );
190
+
191
+ // Colors are built-in with OKLCH system
192
+ // Use: var(--brand), var(--accent), etc.
193
+ ```
194
+
195
+ ### Example 2: Production Build with Custom Classes
196
+
197
+ **Scenario**: You want to generate only specific classes to reduce CSS size.
198
+
199
+ ```scss
200
+ // Before (generated all classes)
201
+ @use 'eva-css-fluid/src' as *;
202
+
203
+ // After (optimized)
204
+ @use 'eva-css-fluid/src' as * with (
205
+ $sizes: (16, 24, 50, 100),
206
+ $custom-class: true,
207
+ $class-config: (
208
+ w: (50, 100), // Only width-50 and width-100
209
+ h: (50, 100), // Only height-50 and height-100
210
+ px: (24,), // Only padding-x-24
211
+ py: (24,), // Only padding-y-24
212
+ g: (24, 50), // Only gap-24 and gap-50
213
+ br: (16,) // Only border-radius-16
214
+ )
215
+ );
216
+ ```
217
+
218
+ **Result**: Significantly smaller CSS output, perfect for production.
219
+
220
+ ### Example 3: Development Mode
221
+
222
+ **Scenario**: You're in development and want CSS variables only (no classes).
223
+
224
+ ```scss
225
+ @use 'eva-css-fluid/src' as * with (
226
+ $build-class: false, // Don't generate utility classes
227
+ $px-rem-suffix: true // Add debug values
228
+ );
229
+ ```
230
+
231
+ Then use in your CSS:
232
+
233
+ ```scss
234
+ .my-component {
235
+ width: var(--64);
236
+ padding: var(--16);
237
+ border-radius: var(--8);
238
+
239
+ // Debug values available:
240
+ // var(--64-px) → pixel value
241
+ // var(--64-rem) → rem value
242
+ }
243
+ ```
244
+
245
+ ### Example 4: Gradual Migration
246
+
247
+ **Scenario**: You want to migrate gradually, keeping both frameworks.
248
+
249
+ ```scss
250
+ // Load EVA CSS with custom namespace
251
+ @use 'eva-css-fluid/src' as eva with (
252
+ $sizes: (16, 24, 32, 48, 64)
253
+ );
254
+
255
+ // Keep your old framework temporarily
256
+ @import 'old-framework';
257
+
258
+ // Now you can use both:
259
+ .new-component {
260
+ padding: var(--eva-16);
261
+ }
262
+
263
+ .old-component {
264
+ padding: $old-spacing-md;
265
+ }
266
+ ```
267
+
268
+ ## Troubleshooting
269
+
270
+ ### Error: "Size 16 is required as a base size"
271
+
272
+ **Solution**: Add `16` to your `$sizes` list:
273
+
274
+ ```scss
275
+ @use 'eva-css-fluid/src' as * with (
276
+ $sizes: (4, 8, 16, 24, 32, 48, 64) // Add 16 here
277
+ );
278
+ ```
279
+
280
+ ### Error: "Unknown property 'xyz' in $class-config"
281
+
282
+ **Solution**: Use valid property abbreviations. Check the list of available properties in [Common Gotchas](#3-property-names-in-class-config).
283
+
284
+ ### Error: "When $custom-class is true, $class-config must be a map"
285
+
286
+ **Solution**: Provide a valid `$class-config` map:
287
+
288
+ ```scss
289
+ @use 'eva-css-fluid/src' as * with (
290
+ $custom-class: true,
291
+ $class-config: (
292
+ w: (50, 100),
293
+ px: (24,)
294
+ )
295
+ );
296
+ ```
297
+
298
+ ### Compilation is Slow
299
+
300
+ **Solutions**:
301
+
302
+ 1. Use `$custom-class: true` to reduce generated classes
303
+ 2. Use `$build-class: false` if you only need CSS variables
304
+ 3. Disable `$px-rem-suffix` in production
305
+
306
+ ### CSS Output is Too Large
307
+
308
+ **Solutions**:
309
+
310
+ 1. Enable custom class mode:
311
+ ```scss
312
+ @use 'eva-css-fluid/src' as * with (
313
+ $custom-class: true,
314
+ $class-config: (
315
+ // Only include what you need
316
+ )
317
+ );
318
+ ```
319
+
320
+ 2. Use the `eva-purge` package to remove unused classes:
321
+ ```bash
322
+ npm install @eva-css/eva-purge
323
+ eva-purge input.css output.css --html "**/*.html"
324
+ ```
325
+
326
+ ## Getting Help
327
+
328
+ - **Documentation**: [eva-css.xyz](https://eva-css.xyz)
329
+ - **GitHub Issues**: [github.com/nkdeus/eva/issues](https://github.com/nkdeus/eva/issues)
330
+ - **Examples**: See `demo/` folder in the repository
331
+
332
+ ## Next Steps
333
+
334
+ 1. ✅ Complete the migration
335
+ 2. 📚 Read the [full documentation](./README.md)
336
+ 3. 🎨 Explore the [OKLCH color system](./README.md#-oklch-color-system)
337
+ 4. ⚡ Optimize your build with [custom classes](./README.md#custom-class-mode-custom-class-true)
package/README.md CHANGED
@@ -62,8 +62,32 @@ pnpm add eva-css-fluid
62
62
  yarn add eva-css-fluid
63
63
  ```
64
64
 
65
+ **Migrating from another framework?** See the [Migration Guide](./MIGRATION.md) for detailed instructions.
66
+
65
67
  ## 🚀 Quick Start
66
68
 
69
+ ### New Project (Recommended)
70
+
71
+ Get started instantly with a fully configured project:
72
+
73
+ ```bash
74
+ npm init eva-css my-project
75
+ cd my-project
76
+ npm install
77
+ npm run dev
78
+ ```
79
+
80
+ This scaffolds a complete EVA CSS project with:
81
+ - ✅ Pre-configured `eva.config.cjs`
82
+ - ✅ Example HTML and SCSS files
83
+ - ✅ Build scripts with purge support
84
+ - ✅ Ready to customize with your design sizes
85
+
86
+ **Choose from 3 templates:**
87
+ - **Minimal** - Variables only, no utilities
88
+ - **Utility** - Full utility classes (recommended)
89
+ - **Full** - Everything + examples + theme switching
90
+
67
91
  ### Using Pre-built CSS
68
92
 
69
93
  ```html
@@ -72,13 +96,72 @@ yarn add eva-css-fluid
72
96
 
73
97
  ### Using SCSS with Default Configuration
74
98
 
99
+ **Simple import** (Sass automatically finds the package in node_modules):
100
+
75
101
  ```scss
76
102
  @use 'eva-css-fluid';
77
103
  ```
78
104
 
105
+ **Or with explicit path** (if needed):
106
+
107
+ ```scss
108
+ @use 'eva-css-fluid/src' as *;
109
+ ```
110
+
111
+ **Compilation** (no --load-path needed!):
112
+
113
+ ```bash
114
+ # Simple - Sass finds the package automatically
115
+ npx sass styles/main.scss:styles/main.css
116
+
117
+ # Or with older Sass versions
118
+ npx sass --load-path=node_modules styles/main.scss:styles/main.css
119
+ ```
120
+
79
121
  ### Using SCSS with Custom Configuration
80
122
 
81
- **This is the main feature of EVA CSS!** Simply change the `$sizes` to match your Figma design:
123
+ **This is the main feature of EVA CSS!** You can configure EVA CSS in two ways:
124
+
125
+ #### Option 1: JSON Configuration (Recommended)
126
+
127
+ Create `eva.config.cjs` in your project root:
128
+
129
+ ```javascript
130
+ // eva.config.cjs
131
+ module.exports = {
132
+ sizes: [4, 8, 16, 32, 64, 128], // 👈 Change these to YOUR design sizes!
133
+ fontSizes: [14, 16, 20, 24, 32], // 👈 Change these to YOUR font sizes!
134
+ buildClass: true,
135
+ pxRemSuffix: false
136
+ };
137
+ ```
138
+
139
+ Or add to your `package.json`:
140
+
141
+ ```json
142
+ {
143
+ "eva": {
144
+ "sizes": [4, 8, 16, 32, 64, 128],
145
+ "fontSizes": [14, 16, 20, 24, 32],
146
+ "buildClass": true
147
+ }
148
+ }
149
+ ```
150
+
151
+ Then simply import EVA CSS:
152
+
153
+ ```scss
154
+ @use 'eva-css-fluid';
155
+ ```
156
+
157
+ And build with the integrated script:
158
+
159
+ ```bash
160
+ npm run build
161
+ # Configuration is automatically loaded from eva.config.cjs or package.json
162
+ ```
163
+
164
+ #### Option 2: SCSS Variables
82
165
 
83
166
  ```scss
84
167
  // Example: Sizes extracted from Figma design
@@ -108,6 +191,86 @@ yarn add eva-css-fluid
108
191
 
109
192
  ## 🎨 Configuration Options
110
193
 
194
+ ### JSON Configuration (eva.config.cjs or package.json)
195
+
196
+ | Option | Type | Default | Description |
197
+ |--------|------|---------|-------------|
198
+ | `sizes` | `number[]` | `[4, 8, 12, 16, ...]` | Available fluid size values (must include 16) |
199
+ | `fontSizes` | `number[]` | `[12, 14, 16, ...]` | Available font sizes |
200
+ | `buildClass` | `boolean` | `true` | Generate utility classes or variables only |
201
+ | `pxRemSuffix` | `boolean` | `false` | Add px/rem static values for debugging |
202
+ | `nameBySize` | `boolean` | `true` | Use size values in variable names |
203
+ | `customClass` | `boolean` | `false` | Enable custom class filtering |
204
+ | `classConfig` | `object` | `{}` | Map of properties to sizes for custom classes |
205
+ | `debug` | `boolean` | `false` | Show configuration summary during compilation |
206
+ | **`theme.name`** | `string` | `'eva'` | Theme name (CSS class: `.theme-{name}`) |
207
+ | **`theme.colors`** | `object` | See below | Theme colors (HEX or OKLCH) |
208
+ | **`theme.lightMode`** | `object` | `{lightness:96.4, darkness:6.4}` | Light mode configuration |
209
+ | **`theme.darkMode`** | `object` | `{lightness:5, darkness:95}` | Dark mode configuration |
210
+ | **`theme.autoSwitch`** | `boolean` | `false` | Auto-switch based on prefers-color-scheme |
211
+ | `purge.enabled` | `boolean` | `false` | Enable CSS purging/tree-shaking |
212
+ | `purge.content` | `string[]` | `['**/*.{html,js,...}']` | Files to scan for used classes |
213
+ | `purge.css` | `string` | `'dist/eva.css'` | Input CSS file to purge |
214
+ | `purge.output` | `string` | `'dist/eva-purged.css'` | Output path for purged CSS |
215
+ | `purge.safelist` | `string[]` | `['theme-', ...]` | Classes/patterns to always keep |
216
+
217
+ #### Theme Colors Configuration
218
+
219
+ Define your theme colors in HEX (auto-converted to OKLCH) or OKLCH format:
220
+
221
+ ```javascript
222
+ // eva.config.cjs
223
+ module.exports = {
224
+ theme: {
225
+ name: 'myapp',
226
+ colors: {
227
+ // HEX format (from Figma, design tools, etc.)
228
+ brand: '#ff5733', // Automatically converted to OKLCH
229
+ accent: '#7300ff',
230
+ extra: '#ffe500',
231
+
232
+ // Or OKLCH format (for precise control)
233
+ dark: { lightness: 20, chroma: 0.05, hue: 200 },
234
+ light: { lightness: 95, chroma: 0.01, hue: 200 }
235
+ },
236
+ lightMode: {
237
+ lightness: 96.4, // Light background
238
+ darkness: 6.4 // Dark text
239
+ },
240
+ darkMode: {
241
+ lightness: 5, // Dark background
242
+ darkness: 95 // Light text
243
+ },
244
+ autoSwitch: false // Manual toggle with .toggle-theme class
245
+ }
246
+ };
247
+ ```
248
+
249
+ **Available colors:** `brand`, `accent`, `extra`, `dark`, `light`
250
+
251
+ **Color formats:**
252
+ - **HEX**: `"#ff5733"` - Automatically converted via eva-colors
253
+ - **OKLCH**: `{ lightness: 68, chroma: 0.21, hue: 33.69 }`
254
+
255
+ **Usage in HTML:**
256
+
257
+ ```html
258
+ <body class="current-theme theme-myapp">
259
+ <h1 class="_c-brand">Hello World</h1>
260
+
261
+ <button onclick="document.body.classList.toggle('toggle-theme')">
262
+ Toggle Dark Mode
263
+ </button>
264
+ </body>
265
+ ```
266
+
267
+ **Configuration Priority:**
268
+ 1. JSON config file (`eva.config.cjs` or `eva.config.js`)
269
+ 2. package.json `"eva"` key
270
+ 3. SCSS `@use ... with ()` variables
271
+
272
+ ### SCSS Variables (when using @use with)
273
+
111
274
  | Variable | Default | Description |
112
275
  |----------|---------|-------------|
113
276
  | `$sizes` | `4, 8, 12, 16, 24, 32, 48, 64, 96, 128` | Available fluid size values |
@@ -115,7 +278,22 @@ yarn add eva-css-fluid
115
278
  | `$build-class` | `true` | Generate utility classes (`true`) or variables only (`false`) |
116
279
  | `$px-rem-suffix` | `false` | Add px/rem static values for debugging |
117
280
  | `$name-by-size` | `true` | Use size values in variable names |
118
- | `$custom-class` | `false` | Enable custom class generation |
281
+ | `$custom-class` | `false` | Enable custom class filtering |
282
+ | `$class-config` | `()` | Map of properties to sizes when `$custom-class: true` |
283
+ | `$debug` | `false` | Show class generation summary during compilation |
284
+
285
+ ### CLI Commands
286
+
287
+ ```bash
288
+ # Validate your configuration
289
+ npx eva-css validate
290
+
291
+ # Generate SCSS variables from JSON config
292
+ npx eva-css generate
293
+
294
+ # Get help
295
+ npx eva-css help
296
+ ```
119
297
 
120
298
  ## 💡 Usage Examples
121
299
 
@@ -144,6 +322,83 @@ yarn add eva-css-fluid
144
322
  }
145
323
  ```
146
324
 
325
+ ### Custom Class Mode (`$custom-class: true`)
326
+
327
+ Generate only specific classes to reduce CSS output size:
328
+
329
+ ```scss
330
+ @use 'eva-css-fluid/src' as * with (
331
+ $sizes: (24, 50, 100),
332
+ $custom-class: true,
333
+ $class-config: (
334
+ w: (50, 100), // Only .w-50 and .w-100
335
+ px: (24,), // Only .px-24 (note trailing comma)
336
+ g: (24, 50) // Only .g-24 and .g-50
337
+ )
338
+ );
339
+ ```
340
+
341
+ This generates only the specified classes, perfect for production builds or when you need fine control over output size.
342
+
343
+ ### Pre-configured Entry Points
344
+
345
+ EVA CSS provides multiple entry points for different use cases:
346
+
347
+ ```scss
348
+ // Full framework (default) - Everything included
349
+ @use 'eva-css-fluid';
350
+
351
+ // Variables only - Just CSS variables, no utility classes
352
+ @use 'eva-css-fluid/variables';
353
+
354
+ // Core framework - Variables + reset + typography, no utilities
355
+ @use 'eva-css-fluid/core';
356
+
357
+ // Colors only - Just the OKLCH color system
358
+ @use 'eva-css-fluid/colors';
359
+ ```
360
+
361
+ **When to use each:**
362
+ - **Default** (`eva-css-fluid`): Full-featured projects with utility classes
363
+ - **Variables** (`eva-css-fluid/variables`): Building custom components
364
+ - **Core** (`eva-css-fluid/core`): Foundation + custom utilities
365
+ - **Colors** (`eva-css-fluid/colors`): Adding EVA colors to existing projects
366
+
367
+ ### Debug Mode
368
+
369
+ Enable debug mode to see a summary of your configuration during compilation:
370
+
371
+ ```scss
372
+ @use 'eva-css-fluid' with (
373
+ $sizes: (16, 24, 50, 100),
374
+ $debug: true // ← Shows configuration summary
375
+ );
376
+ ```
377
+
378
+ **Output example:**
379
+ ```
380
+ ╔══════════════════════════════════════════════════════════════
381
+ ║ EVA CSS - Configuration Summary
382
+ ╠══════════════════════════════════════════════════════════════
383
+ ║ Sizes: 16, 24, 50, 100
384
+ ║ Total sizes: 4
385
+ ║ Font sizes: 16, 24
386
+ ║ Total font sizes: 2
387
+ ╠══════════════════════════════════════════════════════════════
388
+ ║ Build Configuration:
389
+ ║ - Build classes: true
390
+ ║ - Custom class mode: false
391
+ ║ - Px/Rem suffix: false
392
+ ║ - Name by size: true
393
+ ╠══════════════════════════════════════════════════════════════
394
+ ║ Estimated Utility Classes:
395
+ ║ - Size properties: ~256 classes
396
+ ║ - Available properties: w, mw, h, p, px, pr, py, br, mb, mr, ml, mt, pt, pb, g, gap
397
+ ╚══════════════════════════════════════════════════════════════
398
+ ```
399
+
400
+ Perfect for understanding what's being generated and optimizing your configuration!
401
+
147
402
  ## 🎨 Fluid Scaling
148
403
 
149
404
  EVA CSS uses modern CSS `clamp()` for fluid scaling:
@@ -266,12 +521,64 @@ npx sass my-project.scss:my-project.css
266
521
 
267
522
  **The magic:** All sizes scale fluidly across viewport sizes using `clamp()` - no media queries needed!
268
523
 
524
+ ## 🗜️ Production Optimization (Tree-shaking)
525
+
526
+ EVA CSS includes automatic CSS purging to remove unused classes in production builds.
527
+
528
+ ### Enable in Configuration
529
+
530
+ ```javascript
531
+ // eva.config.cjs
532
+ module.exports = {
533
+ sizes: [16, 24, 32, 64],
534
+ fontSizes: [16, 24, 32],
535
+ purge: {
536
+ enabled: true, // Enable purging
537
+ content: ['src/**/*.{html,js,jsx,tsx}'], // Files to scan
538
+ css: 'dist/eva.css', // Input CSS
539
+ output: 'dist/eva-purged.css', // Output CSS
540
+ safelist: ['theme-', 'current-'] // Classes to keep
541
+ }
542
+ };
543
+ ```
544
+
545
+ ### Build with Purge
546
+
547
+ ```bash
548
+ # Build with purge (if enabled in config)
549
+ npm run build
550
+
551
+ # Or force purge via CLI flag
552
+ npm run build:purge
553
+ ```
554
+
555
+ **Results:** Typically reduces CSS file size by 60-90% depending on usage.
556
+
557
+ ### Manual Purge with eva-purge
558
+
559
+ For more control, use the standalone `eva-purge` package:
560
+
561
+ ```bash
562
+ # Install
563
+ npm install --save-dev eva-css-purge
564
+
565
+ # Run purge
566
+ npx eva-purge --css dist/eva.css --content "src/**/*.html"
567
+
568
+ # Or use eva.config.cjs
569
+ npx eva-purge --config eva.config.cjs
570
+ ```
571
+
572
+ See [eva-purge documentation](https://www.npmjs.com/package/eva-css-purge) for more options.
573
+
269
574
  ## 🛠️ Build from Source
270
575
 
271
576
  ```bash
272
577
  cd packages/eva-css
273
- npm run build # Build expanded CSS
578
+ npm run build # Build with config (includes purge if enabled)
274
579
  npm run build:min # Build minified CSS
580
+ npm run build:purge # Build with purge (force)
581
+ npm run build:sass # Build without config (pure SCSS)
275
582
  npm run watch # Watch mode for development
276
583
  ```
277
584