tailwind-unwind 0.2.0 → 0.3.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/README.md +14 -4
- package/dist/{chunk-FASYIEVZ.js → chunk-4GXMK3NB.js} +542 -107
- package/dist/chunk-4GXMK3NB.js.map +1 -0
- package/dist/cli/index.js +26 -8
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +144 -73
- package/dist/index.js +21 -1
- package/package.json +10 -1
- package/tailwind-unwind.config.example.json +5 -2
- package/dist/chunk-FASYIEVZ.js.map +0 -1
package/README.md
CHANGED
|
@@ -159,11 +159,15 @@ npx tailwind-unwind generate <path> --output <file.css>
|
|
|
159
159
|
| `--max-size <n>` | `5` | Maximum classes per set |
|
|
160
160
|
| `--top <n>` | `10` | Max number of component classes to generate |
|
|
161
161
|
| `--prefix <name>` | `twu-` | Namespace prefix for generated classes |
|
|
162
|
+
| `--format <type>` | `console` | Output format: `console` or `json` |
|
|
163
|
+
| `--from-report <file>` | — | Generate from `analyze --format json` output |
|
|
164
|
+
| `--extractable-only` | — | Only patterns marked extractable in analyze |
|
|
162
165
|
|
|
163
166
|
```bash
|
|
164
167
|
npx tailwind-unwind generate ./src --output styles.css
|
|
165
|
-
npx tailwind-unwind
|
|
166
|
-
npx tailwind-unwind generate
|
|
168
|
+
npx tailwind-unwind analyze ./src --format json > report.json
|
|
169
|
+
npx tailwind-unwind generate --from-report report.json --output styles.css
|
|
170
|
+
npx tailwind-unwind generate ./src --output styles.css --extractable-only --format json
|
|
167
171
|
```
|
|
168
172
|
|
|
169
173
|
**Example output (`styles.css`):**
|
|
@@ -206,10 +210,13 @@ Supports the same flags as `generate`, plus:
|
|
|
206
210
|
| Flag | Description |
|
|
207
211
|
|------|-------------|
|
|
208
212
|
| `--dry-run` | Preview replacements without writing files |
|
|
213
|
+
| `--prettier` | Format modified files with Prettier (optional peer dependency) |
|
|
214
|
+
| `--format json` | Machine-readable output for CI |
|
|
209
215
|
|
|
210
216
|
```bash
|
|
211
217
|
npx tailwind-unwind apply ./src --output styles.css --dry-run
|
|
212
|
-
npx tailwind-unwind apply ./src --output styles.css
|
|
218
|
+
npx tailwind-unwind apply ./src --output styles.css --prettier
|
|
219
|
+
npx tailwind-unwind apply ./src --output styles.css --from-report report.json --format json
|
|
213
220
|
```
|
|
214
221
|
|
|
215
222
|
**What gets replaced:**
|
|
@@ -218,8 +225,10 @@ npx tailwind-unwind apply ./src --output styles.css
|
|
|
218
225
|
|---------|-----------|
|
|
219
226
|
| `className="flex items-center p-4"` | ✅ |
|
|
220
227
|
| `className={cn('flex', 'items-center', 'p-4')}` | ✅ (static args only) |
|
|
228
|
+
| `className={cn('flex p-4', isActive && 'bg-blue')}` | ✅ partial |
|
|
229
|
+
| `` className={`flex p-4 ${active ? 'bg-blue' : ''}`} `` | ✅ partial (static part) |
|
|
230
|
+
| `className={buttonVariants()}` | ✅ (cva/tv, no args) |
|
|
221
231
|
| `className={getClasses()}` | ❌ skipped |
|
|
222
|
-
| `` className={`flex ${active ? 'p-4' : ''}`} `` | ❌ skipped (dynamic) |
|
|
223
232
|
|
|
224
233
|
**Before → After:**
|
|
225
234
|
|
|
@@ -267,6 +276,7 @@ Scans `.tsx`, `.jsx`, `.ts`, `.js` recursively. Ignores `node_modules`, `.next`,
|
|
|
267
276
|
- **Static strings:** `className="flex p-4"` / `class="flex p-4"`
|
|
268
277
|
- **Template literals:** static segments extracted; `${...}` expressions flagged
|
|
269
278
|
- **Merge utilities:** `cn()`, `clsx()`, `classnames()`, `twMerge()`, `cx()`
|
|
279
|
+
- **Variant APIs:** `cva()`, `tv()` definitions and no-arg calls like `buttonVariants()`
|
|
270
280
|
- **Dynamic expressions:** `className={getClasses()}` — warning, skipped
|
|
271
281
|
|
|
272
282
|
Class order is normalized: `flex p-4` and `p-4 flex` are treated as the same set.
|