@maccesar/titools 3.1.0 → 3.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.
@@ -1,25 +1,6 @@
1
1
  # PurgeTSS CLI Commands
2
2
 
3
- > **Info: What's new in v7.5.3 / v7.6.x / v7.7.0 / v7.8.0 / v7.9.0**
4
- > - **Opacity modifiers on semantic colors (v7.9.0)** — writing `bg-surface/65` (or any opacity modifier on a class mapped to a name in `semantic.colors.json`) now produces a working rule with Light/Dark switching preserved. PurgeTSS auto-derives a `<originalKey>_<alphaPercent>` entry in `semantic.colors.json` with the original `light`/`dark` hex values plus the requested alpha for both modes, then emits the rule against the derived key. Re-runs are idempotent; manual edits with conflicting values halt the build with a `Conflict` error. New alpha entries require one full Titanium build to be picked up — Liveview hot-reload alone does not refresh `semantic.colors.json`.
5
- > - **Gradient + Window/View/ImageView preset fixes (v7.9.0)** — `theme.Window` / `theme.View` / `theme.ImageView` no longer leak the framework presets (white background, `Ti.UI.SIZE`, iOS `hires: true`) when defined at the top level (replace mode), so a Window declared at `theme.Window` with a `backgroundGradient` no longer ghosts on top of a default `backgroundColor: '#FFFFFF'`. `theme.extend.Window` keeps merging with the defaults as before. Also fixed: tonal palette inversion bug, position-dependent `from`/`to` color ordering after `sort()`, and `bg-gradient-to-X` direction silently dropped when combined with `from-X to-Y` colors.
6
- > - **Glossary path renamed (v7.9.0, breaking)** — the user-facing glossary output path was renamed from `purgetss/experimental/tailwind-classes/` to `purgetss/glossary/tailwind-classes/`. Tooling or CI that reads from the old path needs updating on upgrade — no transition shim. The `--glossary` flag and command surface are unchanged.
7
- > - **`images --width <n>` flag (v7.8.0)** — pins Android `mdpi` (= iPhone `@1x`) to a specific pixel width, with larger scales deriving as ×1.5, ×2, ×3, ×4 from that base. Use it for SVG sources from vector editors with disproportionate viewBoxes (Affinity, Illustrator). CLI-only; there is no matching `images:` config property because the right width is per-asset. See [`images` Command](#images-command).
8
- > - **Class syntax pre-validation (v7.8.0)** — `purgetss` now stops with a structured `Class Syntax Error` block (file + line + suggested fix) when it detects known class-name mistakes: inverted negative sign (`top-(-10)` → `-top-(10)`), Tailwind-style brackets (`top-[10px]` → `top-(10px)`), empty parentheses (`wh-()`), whitespace inside parentheses (`wh-( 200 )`), and redundant `px` unit (`top-(10px)` → `top-(10)`). All offenders are reported in one run. Generic unknown classes still flow into the `// Unused or unsupported classes` block in `app.tss`.
9
- > - **Negative-values-in-parens parser fix (v7.8.0)** — classes like `top-(-10)`, `mt-(-5)`, and `origin-(-10,-20)` no longer crash with `Cannot read properties of null (reading 'pop')`. The parser now extracts the `(...)` portion first, so a `-` inside the value does not break the split.
10
- > - **`brand:` config grouped (v7.7.0)** — the flat `brand:` block from v7.6.0 was reorganized into purpose-based sections: `brand.logos`, `brand.padding`, `brand.android`, `brand.ios`, and `brand.colors`. Old projects keep working — newly-generated configs use the grouped form.
11
- > - **Separate Android brand inputs (v7.7.0)** — `brand` can now use one logo for the general brand set, another for Android launcher icons (`logos.androidLauncher` / `--icon-logo`), and another for Android 12+ splash artwork (`logos.androidSplash` / `--splash-logo`). Drop `logo-icon.*` and `logo-splash.*` into `purgetss/brand/` or set the paths in `config.cjs`.
12
- > - **Legacy Android splash fallback (v7.7.0)** — `purgetss brand` now regenerates `app/assets/android/default.png` (Alloy) or `Resources/android/default.png` (Classic). `cleanup-legacy` no longer removes `default.png`.
13
- > - **`semantic` works in Classic projects (v7.6.2)** — writes to `Resources/semantic.colors.json` for Classic, keeps writing to `app/assets/semantic.colors.json` for Alloy.
14
- > - **Confirmation prompt for destructive writes (v7.6.1)** — `brand` and `images` ask `[y/N/a]` before overwriting (auto-skipped on non-TTY, with `-y`/`--yes`, or `PURGETSS_YES=1`).
15
- > - **New `brand` command (v7.6.0)** — generates the complete Titanium branding set (launcher icons, adaptive icons, iOS 18+ Dark/Tinted variants, marketplace artwork, optional notification/splash) from a single SVG or PNG logo. See [`brand` Command](#brand-command) and the deep-dive [app-branding.md](./app-branding.md).
16
- > - **New `images` command (v7.6.0)** — generates multi-density UI images (Android `res-*` densities + iPhone `@1x`/`@2x`/`@3x` scales) from sources in `./purgetss/images/`. See [`images` Command](#images-command) and the deep-dive [multi-density-images.md](./multi-density-images.md).
17
- > - **New `semantic` command (v7.6.0)** — generates Titanium semantic colors (Light/Dark) into `app/assets/semantic.colors.json` with two modes (tonal palette vs. single purpose-based color). See [`semantic` Command](#semantic-command) and the deep-dive [semantic-colors.md](./semantic-colors.md).
18
- > - **`brand:` and `images:` config sections** auto-injected into `purgetss/config.cjs` on first run. Percentages may be written as quoted strings like `'15%'` or as plain numbers.
19
- > - **Default font family classes (v7.5.3)** — `font-sans`, `font-serif`, and `font-mono` generated automatically with platform-appropriate values.
20
- > - **XML validation (v7.5.3)** — detects illegal `--` sequences inside XML comments during pre-validation.
21
-
22
- This page lists the commands available in PurgeTSS.
3
+ This page lists the commands available in PurgeTSS. For release-by-release feature additions and behavior changes, see [Version History](./version-history.md).
23
4
 
24
5
  ## Setup Commands
25
6
 
@@ -221,10 +202,11 @@ purgetss brand path/to/logo.svg # positional logo path override
221
202
  | Flag | Purpose |
222
203
  | --- | --- |
223
204
  | `--bg-color <hex>` | Background color for Android adaptive + iOS/marketplace flatten. |
224
- | `--padding <n>` | Shortcut: sets BOTH Android paddings to the same value for one run. |
205
+ | `--padding <n>` | Shortcut: sets BOTH Android paddings to the same value for one run. Fixed in v7.10.0 — previously only fed `androidAdaptivePadding`, leaving `androidLegacyPadding` at its own config value. |
225
206
  | `--android-adaptive-padding <n>` | Adaptive icon safe-zone % (default `19`). |
226
207
  | `--android-legacy-padding <n>` | Legacy `ic_launcher.png` padding % (default `10`). |
227
208
  | `--ios-padding <n>` | iOS aesthetic padding % (range `2-8`, default `4`). |
209
+ | `--feature-graphic-padding <n>` | (v7.10.0) Vertical padding for `MarketplaceArtworkFeature.png` (range `0-40`, default `12`). |
228
210
 
229
211
  **Optional asset types**
230
212
 
@@ -243,6 +225,7 @@ purgetss brand path/to/logo.svg # positional logo path override
243
225
  | `--dark-bg-color <hex>` | Opaque dark bg for `DefaultIcon-Dark.png` (default: transparent per Apple HIG). |
244
226
  | `--splash-logo <path>` | Override `purgetss/brand/logo-splash.{svg,png}` for Android 12+ splash artwork. |
245
227
  | `--tinted-logo <path>` | Override `purgetss/brand/logo-tinted.{svg,png}`. |
228
+ | `--feature-logo <path>` | (v7.10.0) Override `purgetss/brand/logo-feature.{svg,png}` for the Google Play Feature Graphic (1024×500). |
246
229
  | `--no-dark` | Skip `DefaultIcon-Dark.png`. |
247
230
  | `--no-tinted` | Skip `DefaultIcon-Tinted.png`. |
248
231
 
@@ -277,12 +260,14 @@ brand: {
277
260
  // androidSplash: './docs/splash.svg',
278
261
  // monochrome: './docs/logo-mono.svg',
279
262
  // iosDark: './docs/logo-dark.svg',
280
- // iosTinted: './docs/logo-tinted.svg'
263
+ // iosTinted: './docs/logo-tinted.svg',
264
+ // featureGraphic: './docs/logo-feature.svg' // Google Play 1024×500 banner (v7.10.0)
281
265
  },
282
266
  padding: {
283
- ios: '4%', // iOS aesthetic padding. Range 2-8%.
284
- androidLegacy: '10%', // legacy ic_launcher.png padding %
285
- androidAdaptive: '19%' // adaptive icon safe-zone %. Spec floor 19.44%.
267
+ ios: '4%', // iOS aesthetic padding. Range 2-8%.
268
+ androidLegacy: '10%', // legacy ic_launcher.png padding %
269
+ androidAdaptive: '19%', // adaptive icon safe-zone %. Spec floor 19.44%.
270
+ featureGraphic: '12%' // MarketplaceArtworkFeature.png vertical padding (v7.10.0)
286
271
  },
287
272
  android: {
288
273
  splash: false, // also generate splash_icon.png × 5
@@ -309,14 +294,16 @@ The recommended workflow is convention-first: drop files in `purgetss/brand/`, l
309
294
  ### Examples
310
295
 
311
296
  ```bash
312
- purgetss brand # uses purgetss/brand/logo.svg + config
313
- purgetss brand --bg-color "#0B1326" # override bg color
314
- purgetss brand --icon-logo ./docs/app-icon.svg # dedicated square Android launcher mark
315
- purgetss brand --splash --splash-logo ./docs/splash.svg # custom Android 12+ splash artwork
316
- purgetss brand --notification --splash # add notification + splash
317
- purgetss brand --no-tinted # skip iOS 18+ tinted variant
318
- purgetss brand --dry-run # preview without writing
319
- purgetss brand --cleanup-legacy --dry-run # preview legacy cleanup
297
+ purgetss brand # uses purgetss/brand/logo.svg + config
298
+ purgetss brand --bg-color "#0B1326" # override bg color
299
+ purgetss brand --icon-logo ./docs/app-icon.svg # dedicated square Android launcher mark
300
+ purgetss brand --splash --splash-logo ./docs/splash.svg # custom Android 12+ splash artwork
301
+ purgetss brand --feature-logo ./docs/feature.svg # custom Google Play Feature Graphic (v7.10.0)
302
+ purgetss brand --feature-graphic-padding 8 # tighter Feature Graphic padding (v7.10.0)
303
+ purgetss brand --notification --splash # add notification + splash
304
+ purgetss brand --no-tinted # skip iOS 18+ tinted variant
305
+ purgetss brand --dry-run # preview without writing
306
+ purgetss brand --cleanup-legacy --dry-run # preview legacy cleanup
320
307
  ```
321
308
 
322
309
  ### Android output groups
@@ -349,6 +336,9 @@ purgetss images background/ # re-process one subfolder
349
336
  | `--format <ext>` | Convert all outputs to `webp`, `jpeg`, `png`, `avif`, `gif`, or `tiff`. Default: keep source format. |
350
337
  | `--quality <n>` | Quality `0-100` for lossy formats. Default `85`. |
351
338
  | `--width <n>` | (v7.8.0) Pin Android `mdpi` (= iPhone `@1x`) to `<n>` pixels wide. Larger scales derive as ×1.5, ×2, ×3, ×4 from that base; height stays proportional to the source's aspect ratio. Integer in `[1, 8192]`. |
339
+ | `--opacity <n>` | (v7.10.0) Multiply alpha of every density by `n/100`. Integer in `[0, 100]`. With `--format jpeg`, alpha flattens on white. |
340
+ | `--padding <n>` | (v7.10.0) Shrink the rendered image inside each density canvas by `n%` symmetric borders. Integer in `[0, 40]`. |
341
+ | `--output <relpath>` | (v7.10.0) Override the basename and subpath relative to each platform's `images/` root. |
352
342
  | `--dry-run` | Preview without writing any files. |
353
343
  | `--project <path>` | Project root (defaults to cwd). |
354
344
  | `-y, --yes` | Skip the overwrite confirmation prompt. |
@@ -364,6 +354,16 @@ Use `--width <n>` for SVG sources from vector editors with disproportionate view
364
354
 
365
355
  When you pass an SVG without `--width`, the command prints a one-time hint and falls back to the legacy 4× behavior. This is CLI-only; there is no matching `images:` config property because the right width is per-asset.
366
356
 
357
+ ### When to use `--opacity`, `--padding`, `--output` (v7.10.0)
358
+
359
+ The three v7.10.0 flags are designed for **placeholder / default ImageView** workflows where the source asset is a brand or logo you want to re-render at reduced opacity and/or with extra breathing room — without editing the source file itself.
360
+
361
+ - `--opacity` is a runtime alpha multiplier. JPEG flattens the result on white; PNG/WebP/AVIF keep alpha.
362
+ - `--padding` shrinks the rendered image inside each density canvas, keeping the canvas dimensions and filling the difference with transparent pixels.
363
+ - `--output` retargets the basename and subpath, useful when the source lives outside `purgetss/images/` (e.g. `purgetss/brand/`).
364
+
365
+ All three are **CLI-only by design** — no `config.cjs` equivalent — because they describe per-asset render decisions, not project-wide settings.
366
+
367
367
  ### Config block
368
368
 
369
369
  Defaults live under `images:` in `purgetss/config.cjs`:
@@ -387,6 +387,11 @@ purgetss images background/ # re-process one subfolde
387
387
  purgetss images --android # only Android densities
388
388
  purgetss images --format webp --quality 90 # convert all outputs to WebP
389
389
  purgetss images logo.svg --width 256 # pin SVG output to 256 px @1x/mdpi
390
+ purgetss images logo.svg --opacity 50 --format png # 50% alpha placeholder (v7.10.0)
391
+ purgetss images logo.svg --padding 15 --format png # add 15% breathing room (v7.10.0)
392
+ purgetss images purgetss/brand/logo.svg \
393
+ --opacity 30 --padding 15 \
394
+ --output 'logos/default-image' --format png # placeholder under custom path (v7.10.0)
390
395
  purgetss images --dry-run # preview
391
396
  ```
392
397
 
@@ -482,7 +487,7 @@ purgetss id
482
487
 
483
488
  ## `icon-library` Command
484
489
 
485
- The `icon-library` command copies the free font files for Font Awesome, Material Icons, Material Symbols, and/or Framework7 Icons into `./app/assets/fonts`.
490
+ Copies the bundled free font files (Font Awesome 7, Material Icons, Material Symbols, Framework7 Icons) into `./app/assets/fonts/`. Once the fonts are in place, every official icon class (`fa-home`, `ms-home`, `mi-home`, `f7-house`, etc.) works out of the box — PurgeTSS resolves them at compile time from its own bundled `dist/` files.
486
491
 
487
492
  ```bash
488
493
  purgetss icon-library [--vendor=fa,mi,ms,f7] [--module] [--styles]
@@ -491,412 +496,47 @@ purgetss icon-library [--vendor=fa,mi,ms,f7] [--module] [--styles]
491
496
  purgetss il [-v=fa,mi,ms,f7] [-m] [-s]
492
497
  ```
493
498
 
494
- ### Options and Flags
495
-
496
- - `-v, --vendor [fa,mi,ms,f7]` to copy specific font vendors.
497
- - `-m, --module` to copy the corresponding CommonJS module into the `./app/lib/` folder.
498
- - `-s, --styles` to copy the corresponding `.tss` files into the `./purgetss/styles/` folder for your review.
499
-
500
- `./app/assets/fonts/`
501
- ```bash
502
- FontAwesome7Brands-Regular.ttf
503
- FontAwesome7Free-Regular.ttf
504
- FontAwesome7Free-Solid.ttf
505
- Framework7-Icons.ttf
506
- MaterialIcons-Regular.ttf
507
- MaterialIconsOutlined-Regular.otf
508
- MaterialIconsRound-Regular.otf
509
- MaterialIconsSharp-Regular.otf
510
- MaterialIconsTwoTone-Regular.otf
511
- MaterialSymbolsOutlined-Regular.ttf
512
- MaterialSymbolsRounded-Regular.ttf
513
- MaterialSymbolsSharp-Regular.ttf
514
- ```
515
-
516
- After copying the fonts, you can use them in Buttons and Labels. For example, for Font Awesome, set the font family to `fa` (Solid icons) and use a class like `fa-home`.
517
-
518
- ### Available Font Classes
519
-
520
- - [fontawesome.tss](https://github.com/macCesar/purgeTSS/blob/main/dist/fontawesome.tss)
521
- - [materialicons.tss](https://github.com/macCesar/purgeTSS/blob/main/dist/materialicons.tss)
522
- - [materialsymbols.tss](https://github.com/macCesar/purgeTSS/blob/main/dist/materialsymbols.tss)
523
- - [framework7icons.tss](https://github.com/macCesar/purgeTSS/blob/main/dist/framework7icons.tss)
524
-
525
- ### Copying Specific Font Vendors
526
-
527
- ```bash
528
- purgetss icon-library --vendor="fontawesome, materialicons, materialsymbols, framework7"
529
-
530
- # alias:
531
- purgetss il -v=fa,mi,ms,f7
532
- ```
533
-
534
- Available names and aliases:
535
-
536
- - `fa`, `fontawesome` = Font Awesome Icons
537
- - `mi`, `materialicons` = Material Icons
538
- - `ms`, `materialsymbol` = Material Symbols
539
- - `f7`, `framework7` = Framework7 Icons
540
-
541
- ### CommonJS Module
542
-
543
- You can use the `--module` option to copy the corresponding CommonJS module into the `./app/lib/` folder.
544
-
545
- ```bash
546
- purgetss icon-library --module [--vendor="fontawesome, materialicons, materialsymbols, framework7"]
547
-
548
- # alias:
549
- purgetss il -m [-v=fa,mi,ms,f7]
550
- ```
551
-
552
- Each library includes a CommonJS module that exposes Unicode strings for the icon fonts.
553
-
554
- All prefixes are stripped from their class names and camel-cased. For example:
555
-
556
- - Font Awesome: `fa-flag` becomes `flag`.
557
- - Material Icons: `mi-flag` becomes `flag`.
558
- - Material Symbols: `ms-flag` becomes `flag`.
559
- - Framework7 Icons: `f7-alarm_fill` becomes `alarmFill` and `f7-clock_fill` becomes `clockFill`.
560
-
561
- ### Font Awesome Pro
562
-
563
- If you have a [Font Awesome Pro account](https://fontawesome.com/pro), you can generate a custom `./purgetss/styles/fontawesome.tss` file with the Pro-only classes (except duotone icons; see note below).
564
-
565
- After setting the [@fortawesome scope](https://fontawesome.com/how-to-use/on-the-web/setup/using-package-managers#installing-pro) with your token, install it in your project's root folder using `npm init` and `npm install --save-dev @fortawesome/fontawesome-pro` (current version 7.1.0).
566
-
567
- To generate a new `purgetss/styles/fontawesome.tss`, run `purgetss build`. It also copies the Pro font files into `./app/assets/fonts` if needed.
568
-
569
- > **Caution**
570
- > Titanium cannot use Font Awesome duotone icons because each icon uses two glyphs.
571
-
572
- ### Font Awesome 7 Beta
573
-
574
- To generate a custom `fontawesome.tss` file from [Font Awesome 7 Beta](https://fontawesome.com/download):
575
-
576
- Move the `css` and `webfonts` folders from `fontawesome-pro-7.0.0-beta3-web/`:
577
-
578
- ```bash
579
- fontawesome-pro-7.0.0-beta3-web/
580
- ├─ css/
581
- └─ webfonts/
582
- ```
583
-
584
- Into `./purgetss/fontawesome-beta/`:
499
+ ### Flags
585
500
 
586
- ```bash
587
- purgetss/
588
- └─ fontawesome-beta/
589
- ├─ css/
590
- └─ webfonts/
591
- ```
501
+ | Flag | Purpose |
502
+ | --- | --- |
503
+ | `-v, --vendor [fa,mi,ms,f7]` | Copy specific font vendors only (default copies all four). |
504
+ | `-m, --module` | Copy the matching CommonJS module into `./app/lib/` so you can reference icons by name from controllers (`icons.fa.home`). |
505
+ | `-s, --styles` | Copy the official `.tss` source files into `./purgetss/styles/` for reference only — not needed for the classes to work. |
592
506
 
593
- Then run `purgetss build` to generate your custom `fontawesome.tss` file and test the new icons.
594
-
595
- ### Font Example File
596
-
597
- To use this file:
598
-
599
- 1. Copy the content of `index.xml` into a new Alloy project.
600
- 2. Install the official icon font files using `purgetss icon-library`.
601
- - Without `--vendor`, PurgeTSS copies all official icon fonts.
602
- 3. Run `purgetss` once to generate the required files.
603
- 4. Compile your app as usual.
604
- 5. Use `liveview` for faster testing.
605
-
606
- ```xml
607
- <Alloy>
608
- <Window>
609
- <View class="grid">
610
- <View class="vertical mx-auto grid-cols-2 gap-y-2">
611
- <Label class="mt-2 text-gray-700" text="FontAwesome" />
612
- <Button class="fa fa-home my-1 h-10 w-10 text-xl text-blue-500" />
613
- <Button class="fa fa-home my-1 h-10 w-10 rounded bg-blue-500 text-xl text-white" />
614
- </View>
615
-
616
- <View class="vertical mx-auto grid-cols-2 gap-y-2">
617
- <Label class="mt-2 text-gray-700" text="Material Icons" />
618
- <Button class="mi mi-home my-1 h-10 w-10 text-xl text-blue-500" />
619
- <Button class="mi mi-home my-1 h-10 w-10 rounded bg-blue-500 text-xl text-white" />
620
- </View>
621
-
622
- <View class="vertical mx-auto grid-cols-2 gap-y-2">
623
- <Label class="mt-2 text-gray-700" text="Material Symbol" />
624
- <Button class="ms ms-home my-1 h-10 w-10 text-xl text-blue-500" />
625
- <Button class="ms ms-home my-1 h-10 w-10 rounded bg-blue-500 text-xl text-white" />
626
- </View>
627
-
628
- <View class="vertical mx-auto grid-cols-2 gap-y-2">
629
- <Label class="mt-2 text-gray-700" text="Framework7-Icons" />
630
- <Button class="f7 f7-house my-1 h-10 w-10 text-xl text-blue-500" />
631
- <Button class="f7 f7-house my-1 h-10 w-10 rounded bg-blue-500 text-xl text-white" />
632
- </View>
633
- </View>
634
- </Window>
635
- </Alloy>
636
- ```
507
+ Vendor aliases: `fa`/`fontawesome`, `mi`/`materialicons`, `ms`/`materialsymbol`, `f7`/`framework7`.
637
508
 
638
- ```tss
639
- /* PurgeTSS v7.2.7
640
- * Created by Cesar Estrada
641
- * https://github.com/macCesar/purgeTSS
642
- */
643
-
644
- /* Ti Elements */
645
- 'View': { width: Ti.UI.SIZE, height: Ti.UI.SIZE }
646
- 'Window': { backgroundColor: '#FFFFFF' }
647
-
648
- /* Main Styles */
649
- '.bg-blue-500': { backgroundColor: '#3b82f6' }
650
- '.gap-y-2': { top: 8, bottom: 8 }
651
- '.grid': { layout: 'horizontal', width: '100%' }
652
- '.grid-cols-2': { width: '50%' }
653
- '.h-10': { height: 40 }
654
- '.mt-2': { top: 8 }
655
- '.mx-auto': { right: null, left: null }
656
- '.my-1': { top: 4, bottom: 4 }
657
- '.rounded': { borderRadius: 4 }
658
- '.text-blue-500': { color: '#3b82f6', textColor: '#3b82f6' }
659
- '.text-gray-700': { color: '#374151', textColor: '#374151' }
660
- '.text-white': { color: '#ffffff', textColor: '#ffffff' }
661
- '.text-xl': { font: { fontSize: 20 } }
662
- '.vertical': { layout: 'vertical' }
663
- '.w-10': { width: 40 }
664
-
665
- /* Default Font Awesome */
666
- '.fa': { font: { fontFamily: 'FontAwesome7Free-Solid' } }
667
- '.fa-home': { text: '\uf015', title: '\uf015' }
668
-
669
- /* Material Icons */
670
- '.mi': { font: { fontFamily: 'MaterialIcons-Regular' } }
671
- '.mi-home': { text: '\ue88a', title: '\ue88a' }
672
-
673
- /* Material Symbols */
674
- '.ms': { font: { fontFamily: 'MaterialSymbolsOutlined-Regular' } }
675
- '.ms-home': { text: '\ue88a', title: '\ue88a' }
676
-
677
- /* Framework7 */
678
- '.f7': { font: { fontFamily: 'Framework7-Icons' } }
679
- '.f7-house': { text: 'house', title: 'house' }
680
- ```
509
+ > **Tip**
510
+ > This is a quick reference. See [Icon Fonts](./icon-fonts.md) for the complete guide — variant tables (`.ms`/`.mso`/`.msr`/`.mss`, `.fa`/`.fas`/`.far`/`.fab`), XML usage patterns, the side-by-side four-family example, Font Awesome Pro / Beta workflow, and instructions for recreating removed libraries.
681
511
 
682
512
  ## `build-fonts` Command
683
513
 
684
- The `build-fonts` command generates a `fonts.tss` file with class definitions and `fontFamily` selectors for serif, sans-serif, cursive, fantasy, or monospace fonts.
685
-
686
- Place all `.ttf` or `.otf` files in `./purgetss/fonts/`, then run the command. You can also use `--module` to generate a CommonJS module in `./app/lib/`.
514
+ Generates `./purgetss/styles/fonts.tss` with class definitions and `fontFamily` selectors for any user-defined fonts dropped into `./purgetss/fonts/` (Google Fonts, brand typefaces, community icon libraries with `.ttf` + `.css` pairs).
687
515
 
688
516
  ```bash
689
- purgetss build-fonts
517
+ purgetss build-fonts [-m] [-f]
690
518
 
691
519
  # alias:
692
- purgetss bf
520
+ purgetss bf [-m] [-f]
693
521
  ```
694
522
 
695
- 1. Creates `./purgetss/styles/fonts.tss` with all class definitions and `fontFamily` selectors.
696
- 2. Copies the font files into `./app/assets/fonts`.
697
- 3. Renames the font files to match their PostScript names so they work on both iOS and Android.
698
-
699
- Example using Bevan and Dancing Script from Google Fonts.
700
-
701
- `./purgetss/fonts/`
702
- ```bash
703
- purgetss
704
- └─ fonts
705
- ├─ Bevan-Italic.ttf
706
- ├─ Bevan-Regular.ttf
707
- ├─ DancingScript-Bold.ttf
708
- ├─ DancingScript-Medium.ttf
709
- ├─ DancingScript-Regular.ttf
710
- └─ DancingScript-SemiBold.ttf
711
- ```
712
-
713
- After running `purgetss build-fonts`:
714
-
715
- `./purgetss/styles/fonts.tss`
716
- ```tss
717
- /* Fonts TSS file generated with PurgeTSS
718
- * https://github.com/macCesar/purgeTSS
719
- */
720
-
721
- '.bevan-italic': { font: { fontFamily: 'Bevan-Italic' } }
722
- '.bevan-regular': { font: { fontFamily: 'Bevan-Regular' } }
723
-
724
- '.dancingscript-bold': { font: { fontFamily: 'DancingScript-Bold' } }
725
- '.dancingscript-medium': { font: { fontFamily: 'DancingScript-Medium' } }
726
- '.dancingscript-regular': { font: { fontFamily: 'DancingScript-Regular' } }
727
- '.dancingscript-semibold': { font: { fontFamily: 'DancingScript-SemiBold' } }
728
- ```
729
-
730
- ### Organizing the Fonts Folder
731
-
732
- For better organization, group each font family in subfolders:
733
-
734
- `./purgetss/fonts/`
735
- ```bash
736
- purgetss
737
- └─ fonts
738
- ├─ bevan
739
- │ ├─ Bevan-Italic.ttf
740
- │ └─ Bevan-Regular.ttf
741
- └─ dancing-script
742
- ├─ DancingScript-Bold.ttf
743
- ├─ DancingScript-Medium.ttf
744
- ├─ DancingScript-Regular.ttf
745
- └─ DancingScript-SemiBold.ttf
746
- ```
747
-
748
- Subfolders don't change the output -- you get the same `fonts.tss` as the flat layout above.
749
-
750
- ### Renaming `fontFamily` Classes
751
-
752
- To use a shorter or different class name, rename the font file.
753
-
754
- `./purgetss/fonts/`
755
- ```bash
756
- purgetss
757
- └─ fonts
758
- └─ dancing-script
759
- ├─ Script-Bold.ttf
760
- ├─ Script-Medium.ttf
761
- ├─ Script-Regular.ttf
762
- └─ Script-SemiBold.ttf
763
- ```
764
-
765
- Running `build-fonts` adjusts the class name accordingly:
766
-
767
- ```tss
768
- '.script-bold': { font: { fontFamily: 'DancingScript-Bold' } }
769
- '.script-medium': { font: { fontFamily: 'DancingScript-Medium' } }
770
- '.script-regular': { font: { fontFamily: 'DancingScript-Regular' } }
771
- '.script-semibold': { font: { fontFamily: 'DancingScript-SemiBold' } }
772
- ```
773
-
774
- ### Icon Font Libraries
775
-
776
- You can add any icon font library that includes a `.ttf` or `.otf` file and a `.css` file with Unicode characters.
777
-
778
- `./purgetss/fonts/`
779
- ```bash
780
- purgetss
781
- └─ fonts
782
- ├─ bevan
783
- ├─ dancing-script
784
- ├─ map-icons
785
- │ ├─ map-icons.css
786
- │ └─ map-icons.ttf
787
- └─ microns
788
- ├─ microns.css
789
- └─ microns.ttf
790
- ```
791
-
792
- After running `purgetss build-fonts`, `fonts.tss` will include the `fontFamily` class definitions and Unicode characters.
793
-
794
- `./purgetss/styles/fonts.tss`
795
- ```tss
796
- /* Fonts TSS file generated with PurgeTSS */
797
- /* https://github.com/macCesar/purgeTSS */
798
-
799
- '.map-icons': { font: { fontFamily: 'map-icons' } }
800
- '.microns': { font: { fontFamily: 'microns' } }
801
-
802
- /* Unicode Characters */
803
- /* To use your Icon Fonts in Buttons and Labels each class sets 'text' and 'title' properties */
804
-
805
- /* map-icons/map-icons.css */
806
- '.map-icon-abseiling': { text: '\ue800', title: '\ue800' }
807
- '.map-icon-accounting': { text: '\ue801', title: '\ue801' }
808
- '.map-icon-airport': { text: '\ue802', title: '\ue802' }
809
- '.map-icon-amusement-park': { text: '\ue803', title: '\ue803' }
810
- '.map-icon-aquarium': { text: '\ue804', title: '\ue804' }
811
-
812
- /* microns/microns.css */
813
- '.mu-arrow-left': { text: '\ue700', title: '\ue700' }
814
- '.mu-arrow-right': { text: '\ue701', title: '\ue701' }
815
- '.mu-arrow-up': { text: '\ue702', title: '\ue702' }
816
- '.mu-arrow-down': { text: '\ue703', title: '\ue703' }
817
- '.mu-left': { text: '\ue704', title: '\ue704' }
818
- ```
819
-
820
- ### Options
821
-
822
- - `-m, --module`: Generate a CommonJS module in `./app/lib/`.
823
- - `-f, --filename`: Use filenames as both font class names and icon prefixes (replaces the old `-p` flag).
824
-
825
- ### CommonJS Module
826
-
827
- Use the `--module` option to generate a CommonJS module called `purgetss.fonts.js` in `./app/lib/`.
828
-
829
- To avoid conflicts with other icon libraries, PurgeTSS keeps each icon's prefix.
830
-
831
- ```bash
832
- purgetss build-fonts --module
833
-
834
- # alias:
835
- purgetss bf -m
836
- ```
837
-
838
- `./app/lib/purgetss.fonts.js`
839
- ```javascript
840
- const icons = {
841
- // map-icons/map-icons.css
842
- mapIcon: {
843
- abseiling: '\ue800',
844
- accounting: '\ue801',
845
- airport: '\ue802',
846
- amusementPark: '\ue803'
847
- },
848
- // microns/microns.css
849
- mu: {
850
- arrowLeft: '\ue700',
851
- arrowRight: '\ue701',
852
- arrowUp: '\ue702',
853
- arrowDown: '\ue703'
854
- }
855
- };
856
- exports.icons = icons;
857
-
858
- const families = {
859
- // map-icons/map-icons.css
860
- mapIcon: 'map-icons',
861
- // microns/microns.css
862
- mu: 'microns'
863
- };
864
- exports.families = families;
865
- ```
866
-
867
- ### Using Filenames for Class Names and Icon Prefixes
868
-
869
- The `--filename` option uses the style's filename as both the font class name and the icon prefix in `fonts.tss` and `purgetss.fonts.js`.
870
-
871
- `./purgetss/fonts/`
872
- ```bash
873
- purgetss
874
- └─ fonts
875
- ├─ map-icons
876
- │ ├─ map.ttf
877
- │ └─ mp.css
878
- └─ microns
879
- ├─ mic.ttf
880
- └─ mc.css
881
- ```
523
+ ### Flags
882
524
 
883
- This generates:
525
+ | Flag | Purpose |
526
+ | --- | --- |
527
+ | `-m, --module` | Also generates a CommonJS module in `./app/lib/purgetss.fonts.js` exposing `exports.icons` and `exports.families` for use from controllers. |
528
+ | `-f, --font-class-from-filename` | Uses the font filename as the class name and icon prefix instead of the font family. Replaces the old `-p` flag. |
884
529
 
885
- ```tss
886
- /* fontFamily classes use the font's filename */
887
- '.map': { font: { fontFamily: 'map-icons' } }
888
- '.mic': { font: { fontFamily: 'microns' } }
530
+ ### What it does
889
531
 
890
- /* map-icons/mp.css */
891
- '.mp-abseiling': { text: '\ue800', title: '\ue800' }
892
- '.mp-accounting': { text: '\ue801', title: '\ue801' }
532
+ 1. Creates `./purgetss/styles/fonts.tss` with one `fontFamily` class per file.
533
+ 2. Copies the font files into `./app/assets/fonts/`, renamed to their PostScript names so they work on both iOS and Android.
893
534
 
894
- /* microns/mc.css */
895
- '.mc-arrow-left': { text: '\ue700', title: '\ue700' }
896
- '.mc-arrow-right': { text: '\ue701', title: '\ue701' }
897
- ```
535
+ > **Tip**
536
+ > This is a quick reference. See [Custom Fonts](./custom-fonts.md) for the complete guide — folder organization, class renaming, adding icon libraries, the `--module` output structure, and `--font-class-from-filename` workflow.
898
537
 
899
- Make sure the new prefix is unique and does not conflict with other class prefixes.
538
+ > **Note**
539
+ > `build-fonts` is for **user-defined fonts only**. The 4 official icon families (Font Awesome 7, Material Icons, Material Symbols, Framework7) are bundled with PurgeTSS and installed via [`icon-library`](#icon-library-command), not `build-fonts`. See [Icon Fonts](./icon-fonts.md).
900
540
 
901
541
  ## `shades` Command
902
542