@maccesar/titools 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.
Files changed (120) hide show
  1. package/AGENTS-TEMPLATE.md +173 -0
  2. package/README.md +867 -0
  3. package/agents/ti-researcher.md +108 -0
  4. package/bin/titools.js +53 -0
  5. package/lib/commands/agents.js +126 -0
  6. package/lib/commands/install.js +188 -0
  7. package/lib/commands/uninstall.js +215 -0
  8. package/lib/commands/update.js +159 -0
  9. package/lib/config.js +119 -0
  10. package/lib/downloader.js +153 -0
  11. package/lib/installer.js +253 -0
  12. package/lib/platform.js +108 -0
  13. package/lib/symlink.js +142 -0
  14. package/lib/utils.js +270 -0
  15. package/package.json +67 -0
  16. package/skills/alloy-expert/SKILL.md +247 -0
  17. package/skills/alloy-expert/assets/ControllerAutoCleanup.js +182 -0
  18. package/skills/alloy-expert/references/alloy-structure.md +381 -0
  19. package/skills/alloy-expert/references/anti-patterns.md +133 -0
  20. package/skills/alloy-expert/references/code-conventions.md +469 -0
  21. package/skills/alloy-expert/references/contracts.md +280 -0
  22. package/skills/alloy-expert/references/controller-patterns.md +520 -0
  23. package/skills/alloy-expert/references/error-handling.md +484 -0
  24. package/skills/alloy-expert/references/examples.md +735 -0
  25. package/skills/alloy-expert/references/migration-patterns.md +298 -0
  26. package/skills/alloy-expert/references/patterns.md +448 -0
  27. package/skills/alloy-expert/references/performance-patterns.md +855 -0
  28. package/skills/alloy-expert/references/security-patterns.md +847 -0
  29. package/skills/alloy-expert/references/state-management.md +779 -0
  30. package/skills/alloy-expert/references/testing.md +872 -0
  31. package/skills/alloy-guides/SKILL.md +214 -0
  32. package/skills/alloy-guides/references/CLI_TASKS.md +243 -0
  33. package/skills/alloy-guides/references/CONCEPTS.md +191 -0
  34. package/skills/alloy-guides/references/CONTROLLERS.md +298 -0
  35. package/skills/alloy-guides/references/MODELS.md +1028 -0
  36. package/skills/alloy-guides/references/PURGETSS.md +56 -0
  37. package/skills/alloy-guides/references/VIEWS_DYNAMIC.md +242 -0
  38. package/skills/alloy-guides/references/VIEWS_STYLES.md +388 -0
  39. package/skills/alloy-guides/references/VIEWS_WITHOUT_CONTROLLERS.md +109 -0
  40. package/skills/alloy-guides/references/VIEWS_XML.md +558 -0
  41. package/skills/alloy-guides/references/WIDGETS.md +176 -0
  42. package/skills/alloy-howtos/SKILL.md +203 -0
  43. package/skills/alloy-howtos/references/best_practices.md +138 -0
  44. package/skills/alloy-howtos/references/cli_reference.md +253 -0
  45. package/skills/alloy-howtos/references/config_files.md +87 -0
  46. package/skills/alloy-howtos/references/custom_tags.md +147 -0
  47. package/skills/alloy-howtos/references/debugging_troubleshooting.md +101 -0
  48. package/skills/alloy-howtos/references/samples.md +167 -0
  49. package/skills/purgetss/SKILL.md +442 -0
  50. package/skills/purgetss/assets/purgetss.config.cjs +17 -0
  51. package/skills/purgetss/references/EXAMPLES.md +247 -0
  52. package/skills/purgetss/references/animation-system.md +1294 -0
  53. package/skills/purgetss/references/apply-directive.md +375 -0
  54. package/skills/purgetss/references/arbitrary-values.md +612 -0
  55. package/skills/purgetss/references/class-index.md +1350 -0
  56. package/skills/purgetss/references/cli-commands.md +948 -0
  57. package/skills/purgetss/references/configurable-properties.md +654 -0
  58. package/skills/purgetss/references/custom-rules.md +161 -0
  59. package/skills/purgetss/references/customization-deep-dive.md +722 -0
  60. package/skills/purgetss/references/dynamic-component-creation.md +489 -0
  61. package/skills/purgetss/references/grid-layout.md +455 -0
  62. package/skills/purgetss/references/icon-fonts.md +609 -0
  63. package/skills/purgetss/references/installation-setup.md +366 -0
  64. package/skills/purgetss/references/opacity-modifier.md +291 -0
  65. package/skills/purgetss/references/platform-modifiers.md +479 -0
  66. package/skills/purgetss/references/smart-mappings.md +42 -0
  67. package/skills/purgetss/references/titanium-resets.md +359 -0
  68. package/skills/purgetss/references/ui-ux-design.md +1526 -0
  69. package/skills/ti-guides/SKILL.md +94 -0
  70. package/skills/ti-guides/references/advanced-data-and-images.md +19 -0
  71. package/skills/ti-guides/references/alloy-cli-advanced.md +84 -0
  72. package/skills/ti-guides/references/alloy-data-mastery.md +29 -0
  73. package/skills/ti-guides/references/alloy-widgets-and-themes.md +19 -0
  74. package/skills/ti-guides/references/android-manifest.md +97 -0
  75. package/skills/ti-guides/references/app-distribution.md +258 -0
  76. package/skills/ti-guides/references/application-frameworks.md +377 -0
  77. package/skills/ti-guides/references/cli-reference.md +402 -0
  78. package/skills/ti-guides/references/coding-best-practices.md +102 -0
  79. package/skills/ti-guides/references/commonjs-advanced.md +134 -0
  80. package/skills/ti-guides/references/hello-world.md +100 -0
  81. package/skills/ti-guides/references/hyperloop-native-access.md +62 -0
  82. package/skills/ti-guides/references/javascript-primer.md +411 -0
  83. package/skills/ti-guides/references/reserved-words.md +36 -0
  84. package/skills/ti-guides/references/resources.md +183 -0
  85. package/skills/ti-guides/references/style-and-conventions.md +48 -0
  86. package/skills/ti-guides/references/tiapp-config.md +609 -0
  87. package/skills/ti-howtos/SKILL.md +174 -0
  88. package/skills/ti-howtos/references/android-platform-deep-dives.md +658 -0
  89. package/skills/ti-howtos/references/automation-fastlane-appium.md +95 -0
  90. package/skills/ti-howtos/references/buffer-codec-streams.md +140 -0
  91. package/skills/ti-howtos/references/cross-platform-development.md +348 -0
  92. package/skills/ti-howtos/references/debugging-profiling.md +543 -0
  93. package/skills/ti-howtos/references/extending-titanium.md +723 -0
  94. package/skills/ti-howtos/references/google-maps-v2.md +169 -0
  95. package/skills/ti-howtos/references/ios-map-kit.md +143 -0
  96. package/skills/ti-howtos/references/ios-platform-deep-dives.md +783 -0
  97. package/skills/ti-howtos/references/local-data-sources.md +301 -0
  98. package/skills/ti-howtos/references/location-and-maps.md +252 -0
  99. package/skills/ti-howtos/references/media-apis.md +210 -0
  100. package/skills/ti-howtos/references/notification-services.md +599 -0
  101. package/skills/ti-howtos/references/remote-data-sources.md +349 -0
  102. package/skills/ti-howtos/references/tutorials.md +502 -0
  103. package/skills/ti-howtos/references/using-modules.md +237 -0
  104. package/skills/ti-howtos/references/web-content-integration.md +307 -0
  105. package/skills/ti-howtos/references/webpack-build-pipeline.md +78 -0
  106. package/skills/ti-ui/SKILL.md +179 -0
  107. package/skills/ti-ui/references/accessibility-deep-dive.md +242 -0
  108. package/skills/ti-ui/references/animation-and-matrices.md +599 -0
  109. package/skills/ti-ui/references/application-structures.md +655 -0
  110. package/skills/ti-ui/references/custom-fonts-styling.md +579 -0
  111. package/skills/ti-ui/references/event-handling.md +393 -0
  112. package/skills/ti-ui/references/gestures.md +473 -0
  113. package/skills/ti-ui/references/icons-and-splash-screens.md +409 -0
  114. package/skills/ti-ui/references/layouts-and-positioning.md +462 -0
  115. package/skills/ti-ui/references/listviews-and-performance.md +619 -0
  116. package/skills/ti-ui/references/orientation.md +362 -0
  117. package/skills/ti-ui/references/platform-ui-android.md +635 -0
  118. package/skills/ti-ui/references/platform-ui-ios.md +469 -0
  119. package/skills/ti-ui/references/scrolling-views.md +252 -0
  120. package/skills/ti-ui/references/tableviews.md +568 -0
@@ -0,0 +1,948 @@
1
+ # PurgeTSS CLI Commands Guide
2
+
3
+ PurgeTSS provides a comprehensive suite of CLI commands for project setup, asset management, and development workflow automation.
4
+
5
+ :::info What's New in v7.2.x
6
+ **FontAwesome 7 & Major Optimization**: PurgeTSS v7.2 introduces full support for **FontAwesome 7**, including the new CSS custom properties format. This version also features a significant reduction in installation size and a complete internal restructuring for better performance and maintainability.
7
+
8
+ **Key Changes:**
9
+ - **Node.js 20+** required (due to "inquirer" v13 upgrade)
10
+ - **FontAwesome 7 Support**: Full compatibility with the new CSS custom properties format
11
+ - **Titanium SDK 13.1 Support**: Updated definitions to support new properties in Titanium SDK 13.1.0.GA
12
+ - **Removed deprecated commands**: "copy-fonts" and "build-legacy" are completely gone
13
+ - **Reduced Installation Size**: Reduced by approximately **45MB** by moving non-essential assets to dev dependencies
14
+ - **Improved Unicode Extraction**: Enhanced support for various Unicode formats and direct character mappings
15
+ :::
16
+
17
+ ## Table of Contents
18
+
19
+ - [PurgeTSS CLI Commands Guide](#purgetss-cli-commands-guide)
20
+ - [Table of Contents](#table-of-contents)
21
+ - [Setup Commands](#setup-commands)
22
+ - [`purgetss init` (alias: `i`)](#purgetss-init-alias-i)
23
+ - [`purgetss create` (alias: `c`)](#purgetss-create-alias-c)
24
+ - [`purgetss install-dependencies` (alias: `id`)](#purgetss-install-dependencies-alias-id)
25
+ - [Development Commands](#development-commands)
26
+ - [`purgetss build` (alias: `b`)](#purgetss-build-alias-b)
27
+ - [`purgetss watch` (alias: `w`)](#purgetss-watch-alias-w)
28
+ - [Asset Commands](#asset-commands)
29
+ - [`purgetss icon-library` (alias: `il`)](#purgetss-icon-library-alias-il)
30
+ - [CommonJS Module](#commonjs-module)
31
+ - [Font Awesome Pro](#font-awesome-pro)
32
+ - [Font Awesome 7 Beta](#font-awesome-7-beta)
33
+ - [Font Example File](#font-example-file)
34
+ - [`purgetss build-fonts` (alias: `bf`)](#purgetss-build-fonts-alias-bf)
35
+ - [For Text Fonts (Google Fonts, etc.)](#for-text-fonts-google-fonts-etc)
36
+ - [For Icon Fonts (Custom Libraries)](#for-icon-fonts-custom-libraries)
37
+ - [CommonJS Module for Custom Fonts](#commonjs-module-for-custom-fonts)
38
+ - [Utility Commands](#utility-commands)
39
+ - [`purgetss shades` (alias: `s`)](#purgetss-shades-alias-s)
40
+ - [`purgetss color-module` (alias: `cm`)](#purgetss-color-module-alias-cm)
41
+ - [`purgetss module` (alias: `m`)](#purgetss-module-alias-m)
42
+ - [Maintenance Commands](#maintenance-commands)
43
+ - [`purgetss update` (alias: `u`)](#purgetss-update-alias-u)
44
+ - [`purgetss sudo-update` (alias: `su`)](#purgetss-sudo-update-alias-su)
45
+ - [Command Quick Reference](#command-quick-reference)
46
+ - [Advanced Usage](#advanced-usage)
47
+ - [Combining Commands for New Projects](#combining-commands-for-new-projects)
48
+ - [Setting Up an Existing Project](#setting-up-an-existing-project)
49
+ - [Quick Reference: New Project Setup Commands](#quick-reference-new-project-setup-commands)
50
+ - [Safelist for Large Projects](#safelist-for-large-projects)
51
+ - [Disabling Specific Classes](#disabling-specific-classes)
52
+ - [Troubleshooting Commands](#troubleshooting-commands)
53
+ - [Verifying Installation](#verifying-installation)
54
+ - [Debug Mode](#debug-mode)
55
+
56
+ ---
57
+
58
+ ## Setup Commands
59
+
60
+ ### `purgetss init` (alias: `i`)
61
+
62
+ Initializes PurgeTSS in an existing Alloy project by creating the `purgetss/config.cjs` file.
63
+
64
+ ```bash
65
+ purgetss init
66
+ # or
67
+ purgetss i
68
+ ```
69
+
70
+ **What it does:**
71
+ - Creates `./purgetss/config.cjs` with minimal configuration
72
+ - Does NOT modify `alloy.jmk` (use `purgetss` for full initialization)
73
+
74
+ **Generated `config.cjs`:**
75
+ ```javascript
76
+ // ./purgetss/config.cjs
77
+ module.exports = {
78
+ purge: {
79
+ mode: 'all',
80
+ method: 'sync', // How to execute the auto-purging task: sync or async
81
+
82
+ // These options are passed directly to PurgeTSS
83
+ options: {
84
+ missing: true, // Reports missing classes
85
+ widgets: false, // Purges widgets too
86
+ safelist: [], // Array of classes to keep
87
+ plugins: [] // Array of properties to ignore
88
+ }
89
+ },
90
+ theme: {
91
+ extend: {}
92
+ }
93
+ };
94
+ ```
95
+
96
+ :::tip
97
+ Use this to create a fresh config.cjs if you want to start over. For first-time setup, just run `purgetss` without any arguments. PurgeTSS looks for the file `./purgetss/config.cjs`, where each section is optional and can be customized. Missing sections will use the default configuration.
98
+ :::
99
+
100
+ ### `purgetss create` (alias: `c`)
101
+
102
+ Creates a new Alloy project with PurgeTSS already configured.
103
+
104
+ ```bash
105
+ purgetss create 'Name of the Project' [options]
106
+ # or
107
+ purgetss c 'Name of the Project' [options]
108
+ ```
109
+
110
+ **Arguments:**
111
+ - Project name (required) - Enclose in single or double quotes
112
+
113
+ **Options:**
114
+ - `-f, --force` - Overwrite existing project without prompting
115
+ - `-d, --dependencies` - Install ESLint and Tailwind CSS dev dependencies
116
+ - `-v, --vendor [fa,mi,ms,f7]` - Copy icon fonts (FontAwesome, Material Icons, Material Symbols, Framework7)
117
+
118
+ **Example:**
119
+ ```bash
120
+ purgetss create 'My Awesome App' --dependencies --vendor=fa,mi
121
+ ```
122
+
123
+ :::caution Requirements
124
+ Ensure that `app.idprefix` and `app.workspace` are configured in Titanium's `config.json`:
125
+
126
+ ```bash
127
+ ti config app.idprefix 'com.yourdomain'
128
+ ti config app.workspace '/path/to/workspace/folder'
129
+ ```
130
+ :::
131
+
132
+ ### `purgetss install-dependencies` (alias: `id`)
133
+
134
+ Simplifies the enhancement of your development workflow in existing projects already using PurgeTSS. It automates the installation of dev dependencies and configuration files.
135
+
136
+ ```bash
137
+ purgetss install-dependencies
138
+ # or
139
+ purgetss id
140
+ ```
141
+
142
+ **What it installs:**
143
+ - **ESLint** with Titanium-specific configuration (`eslint-config-axway`, `eslint-plugin-alloy`)
144
+ - **Tailwind CSS** for IntelliSense support
145
+ - Configuration files: `.editorconfig`, `eslint.config.js`, `tailwind.config.js`
146
+ - VS Code configuration: `.vscode/extensions.json`, `.vscode/settings.json`
147
+
148
+ **Recommended VS Code Extensions:**
149
+ - [XML Tools](https://marketplace.visualstudio.com/items?itemName=DotJoshJohnson.xml) - For XML formatting
150
+ - [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint) - Consistent code quality
151
+ - [Tailwind CSS IntelliSense](https://marketplace.visualstudio.com/items?itemName=bradlc.vscode-tailwindcss) - Intelligent PurgeTSS class support
152
+ - [Tailwind RAW Reorder](https://marketplace.visualstudio.com/items?itemName=KevinYouu.tailwind-raw-reorder-tw4) - Opinionated class sorter for XML and JS files
153
+ - [Intellisense for CSS class names in HTML](https://marketplace.visualstudio.com/items?itemName=Zignd.html-css-class-completion) - Class name completion based on workspace definitions
154
+
155
+ :::caution
156
+ This command will overwrite existing `extensions.json` and `settings.json` files. Create a backup if you want to preserve them.
157
+ :::
158
+
159
+ ## Development Commands
160
+
161
+ ### `purgetss build` (alias: `b`)
162
+
163
+ Manually regenerates `utilities.tss` based on `config.cjs`.
164
+
165
+ ```bash
166
+ purgetss build
167
+ # or
168
+ purgetss b
169
+ ```
170
+
171
+ **Use cases:**
172
+ - After updating `config.cjs`
173
+ - After adding custom fonts to `purgetss/fonts/`
174
+ - When `utilities.tss` seems out of sync
175
+
176
+ ### `purgetss watch` (alias: `w`)
177
+
178
+ Automatically runs PurgeTSS every time the project is compiled. You won't need to manually execute the `build` command each time you make changes.
179
+
180
+ ```bash
181
+ purgetss watch
182
+ # or
183
+ purgetss w
184
+
185
+ # To deactivate:
186
+ purgetss watch --off
187
+ # or
188
+ purgetss w -o
189
+ ```
190
+
191
+ **Default behavior:** Activates auto-purge (runs on every compile)
192
+
193
+ This functionality is particularly valuable when used with LiveView, as it automatically purges your project whenever you make changes, providing immediate feedback and significantly speeding up your prototyping process.
194
+
195
+ **What it installs in `alloy.jmk`:**
196
+ ```javascript
197
+ task('pre:compile', function(event, logger) {
198
+ require('child_process').execSync('purgetss', logger.warn('::PurgeTSS:: Auto-Purging ' + event.dir.project));
199
+ });
200
+ ```
201
+
202
+ :::info
203
+ This feature is exclusively compatible with regular Alloy projects compiled using the `ti build` command. It hasn't been tested with other project types like those built using Webpack or Vue.
204
+ :::
205
+
206
+ ## Asset Commands
207
+
208
+ ### `purgetss icon-library` (alias: `il`)
209
+
210
+ Simplifies the process of copying free font versions of Font Awesome, Material Icons, Material Symbols, and Framework7 Icons to the `./app/assets/fonts` folder.
211
+
212
+ ```bash
213
+ purgetss icon-library [--vendor=fa,mi,ms,f7] [--module] [--styles]
214
+ # or
215
+ purgetss il [-v=fa,mi,ms,f7] [-m] [-s]
216
+ ```
217
+
218
+ **Vendors (names and aliases):**
219
+ - `fa`, `fontawesome` - Font Awesome Icons
220
+ - `mi`, `materialicons` - Material Icons
221
+ - `ms`, `materialsymbols` - Material Symbols
222
+ - `f7`, `framework7` - Framework7 Icons
223
+
224
+ **Options:**
225
+ - `-v, --vendor [fa,mi,ms,f7]` - Copy specific font vendors
226
+ - `-m, --module` - Copy the corresponding CommonJS module into `./app/lib/`
227
+ - `-s, --styles` - Copy the corresponding TSS files into `./purgetss/styles/` for review
228
+
229
+ **Installed font files:**
230
+ ```bash
231
+ ./app/assets/fonts/
232
+ ├─ FontAwesome7Brands-Regular.ttf
233
+ ├─ FontAwesome7Free-Regular.ttf
234
+ ├─ FontAwesome7Free-Solid.ttf
235
+ ├─ Framework7-Icons.ttf
236
+ ├─ MaterialIcons-Regular.ttf
237
+ ├─ MaterialIconsOutlined-Regular.otf
238
+ ├─ MaterialIconsRound-Regular.otf
239
+ ├─ MaterialIconsSharp-Regular.otf
240
+ ├─ MaterialIconsTwoTone-Regular.otf
241
+ ├─ MaterialSymbolsOutlined-Regular.ttf
242
+ ├─ MaterialSymbolsRounded-Regular.ttf
243
+ └─ MaterialSymbolsSharp-Regular.ttf
244
+ ```
245
+
246
+ **Examples:**
247
+ ```bash
248
+ # Install Font Awesome only
249
+ purgetss icon-library --vendor=fa
250
+
251
+ # Install multiple vendors with module
252
+ purgetss il -v=fa,mi,ms -m
253
+
254
+ # Install all available vendors with styles
255
+ purgetss icon-library -v=fa,mi,ms,f7 -m -s
256
+
257
+ # Full vendor names also work
258
+ purgetss icon-library --vendor="fontawesome, materialicons, materialsymbols, framework7"
259
+ ```
260
+
261
+ **Available Font Classes (TSS files):**
262
+ - [fontawesome.tss](https://github.com/macCesar/purgeTSS/blob/master/dist/fontawesome.tss)
263
+ - [materialicons.tss](https://github.com/macCesar/purgeTSS/blob/master/dist/materialicons.tss)
264
+ - [materialsymbols.tss](https://github.com/macCesar/purgeTSS/blob/master/dist/materialsymbols.tss)
265
+ - [framework7icons.tss](https://github.com/macCesar/purgeTSS/blob/master/dist/framework7icons.tss)
266
+
267
+ #### CommonJS Module
268
+
269
+ Use the `--module` option to copy the corresponding CommonJS module into `./app/lib/`. Each library includes a CommonJS module that exposes Unicode strings for the fonts.
270
+
271
+ All prefixes are stripped from their class names and camel-cased:
272
+ - **Font Awesome**: `fa-flag` becomes `flag`
273
+ - **Material Icons**: `mi-flag` becomes `flag`
274
+ - **Material Symbols**: `ms-flag` becomes `flag`
275
+ - **Framework7 Icons**: `f7-alarm_fill` becomes `alarmFill` or `f7-clock_fill` becomes `clockFill`
276
+
277
+ ```bash
278
+ purgetss icon-library --module [--vendor="fontawesome, materialicons, materialsymbols, framework7"]
279
+ # or
280
+ purgetss il -m [-v=fa,mi,ms,f7]
281
+ ```
282
+
283
+ #### Font Awesome Pro
284
+
285
+ If you have a [Font Awesome Pro Account](https://fontawesome.com/pro), you can generate a customized `./purgetss/styles/fontawesome.tss` file containing all the extra classes that the Pro version provides (except duotone icons).
286
+
287
+ **Setup:**
288
+
289
+ 1. Set the [@fortawesome scope](https://fontawesome.com/how-to-use/on-the-web/setup/using-package-managers#installing-pro) with your token
290
+ 2. Install in your project's root folder:
291
+ ```bash
292
+ npm init
293
+ npm install --save-dev @fortawesome/fontawesome-pro
294
+ ```
295
+
296
+ 3. Generate the customized TSS file:
297
+ ```bash
298
+ purgetss build
299
+ ```
300
+
301
+ This will also automatically copy the Pro font files into `./app/assets/fonts` if necessary.
302
+
303
+ :::caution
304
+ Titanium cannot use FontAwesome's duotone icons because they have two separate glyphs for each individual icon.
305
+ :::
306
+
307
+ #### Font Awesome 7 Beta
308
+
309
+ Generate a customized `fontawesome.tss` file from Font Awesome 7 Beta:
310
+
311
+ 1. Download from [Font Awesome](https://fontawesome.com/download)
312
+ 2. Move the `css` and `webfonts` folders from `fontawesome-pro-7.0.0-beta3-web/`:
313
+
314
+ ```bash
315
+ fontawesome-pro-7.0.0-beta3-web/
316
+ ├─ css/
317
+ └─ webfonts/
318
+ ```
319
+
320
+ 3. Into `./purgetss/fontawesome-beta/`:
321
+
322
+ ```bash
323
+ purgetss/
324
+ └─ fontawesome-beta/
325
+ ├─ css/
326
+ └─ webfonts/
327
+ ```
328
+
329
+ 4. Run `purgetss build` to generate your customized `fontawesome.tss` file and beta-test your new icons!
330
+
331
+ #### Font Example File
332
+
333
+ A complete example demonstrating all official icon fonts:
334
+
335
+ ```xml
336
+ <!-- index.xml -->
337
+ <Alloy>
338
+ <Window>
339
+ <View class="grid">
340
+ <View class="vertical mx-auto grid-cols-2 gap-y-2">
341
+ <!-- FontAwesome -->
342
+ <Label class="mt-2 text-gray-700" text="FontAwesome" />
343
+ <Button class="fa fa-home my-1 h-10 w-10 text-xl text-blue-500" />
344
+ <Button class="fa fa-home my-1 h-10 w-10 rounded bg-blue-500 text-xl text-white" />
345
+ </View>
346
+
347
+ <View class="vertical mx-auto grid-cols-2 gap-y-2">
348
+ <!-- Material Icons -->
349
+ <Label class="mt-2 text-gray-700" text="Material Icons" />
350
+ <Button class="mi mi-home my-1 h-10 w-10 text-xl text-blue-500" />
351
+ <Button class="mi mi-home my-1 h-10 w-10 rounded bg-blue-500 text-xl text-white" />
352
+ </View>
353
+
354
+ <View class="vertical mx-auto grid-cols-2 gap-y-2">
355
+ <!-- Material Symbol -->
356
+ <Label class="mt-2 text-gray-700" text="Material Symbol" />
357
+ <Button class="ms ms-home my-1 h-10 w-10 text-xl text-blue-500" />
358
+ <Button class="ms ms-home my-1 h-10 w-10 rounded bg-blue-500 text-xl text-white" />
359
+ </View>
360
+
361
+ <View class="vertical mx-auto grid-cols-2 gap-y-2">
362
+ <!-- Framework7-Icons -->
363
+ <Label class="mt-2 text-gray-700" text="Framework7-Icons" />
364
+ <Button class="f7 f7-house my-1 h-10 w-10 text-xl text-blue-500" />
365
+ <Button class="f7 f7-house my-1 h-10 w-10 rounded bg-blue-500 text-xl text-white" />
366
+ </View>
367
+ </View>
368
+ </Window>
369
+ </Alloy>
370
+ ```
371
+
372
+ **To use this example:**
373
+ 1. Copy the content into a new Alloy project
374
+ 2. Install the official icon fonts: `purgetss icon-library` (without `--vendor` copies all fonts)
375
+ 3. Run `purgetss` to generate the necessary files
376
+ 4. Compile your app
377
+
378
+ :::tip
379
+ Use LiveView to speed up testing and development time.
380
+ :::
381
+
382
+ ### `purgetss build-fonts` (alias: `bf`)
383
+
384
+ Generates TSS file with class definitions for **text fonts** (Google Fonts, custom fonts) and **icon fonts** (any library with `.ttf` + `.css`).
385
+
386
+ ```bash
387
+ purgetss build-fonts [options]
388
+ # or
389
+ purgetss bf [options]
390
+ ```
391
+
392
+ **Options:**
393
+ - `-m, --module` - Generates `purgetss.fonts.js` CommonJS module
394
+ - `-f, --filename` - Uses filenames as class names and icon prefixes
395
+
396
+ #### For Text Fonts (Google Fonts, etc.)
397
+
398
+ **Only need `.ttf` or `.otf` files** - download from [Google Fonts](https://fonts.google.com) or any font provider:
399
+
400
+ ```bash
401
+ ./purgetss/fonts/
402
+ ├─ Bevan-Italic.ttf
403
+ ├─ Bevan-Regular.ttf
404
+ ├─ DancingScript-Bold.ttf
405
+ ├─ DancingScript-Medium.ttf
406
+ └─ DancingScript-Regular.ttf
407
+ ```
408
+
409
+ ```bash
410
+ purgetss bf
411
+ ```
412
+
413
+ **What happens:**
414
+ 1. Creates `./purgetss/styles/fonts.tss` with class definitions
415
+ 2. Copies fonts to `./app/assets/fonts/`
416
+ 3. **Renames fonts to PostScript names** for iOS & Android compatibility
417
+
418
+ **Generated classes:**
419
+ ```tss
420
+ '.bevan-italic': { font: { fontFamily: 'Bevan-Italic' } }
421
+ '.bevan-regular': { font: { fontFamily: 'Bevan-Regular' } }
422
+ '.dancingscript-bold': { font: { fontFamily: 'DancingScript-Bold' } }
423
+ ```
424
+
425
+ **Usage in XML:**
426
+ ```xml
427
+ <Label class="bevan-regular text-2xl" text="Hello World" />
428
+ <Label class="dancingscript-bold text-xl text-blue-500" text="Elegant" />
429
+ ```
430
+
431
+ **Organize in subfolders** for cleaner structure:
432
+ ```bash
433
+ ./purgetss/fonts/
434
+ └─ bevan/
435
+ ├─ Bevan-Italic.ttf
436
+ └─ Bevan-Regular.ttf
437
+ └─ dancing-script/
438
+ └─ DancingScript-Bold.ttf
439
+ ```
440
+
441
+ :::tip PRO TIP: Rename Files = Rename Classes
442
+ The **filename becomes the class name**. Rename `DancingScript-Bold.ttf` to `Script-Bold.ttf` to get `.script-bold` instead of `.dancingscript-bold`. The `fontFamily` value still uses the internal PostScript name.
443
+ :::
444
+
445
+ #### For Icon Fonts (Custom Libraries)
446
+
447
+ **Need `.ttf`/`.otf` AND `.css` with Unicode mappings:**
448
+
449
+ ```bash
450
+ ./purgetss/fonts/
451
+ └─ map-icons/
452
+ ├─ map-icons.css # Contains Unicode mappings
453
+ └─ map-icons.ttf
454
+ ```
455
+
456
+ **Generated classes include Unicode characters:**
457
+ ```tss
458
+ '.map-icons': { font: { fontFamily: 'map-icons' } }
459
+ '.map-icon-home': { text: '\ue800', title: '\ue800' }
460
+ '.map-icon-search': { text: '\ue801', title: '\ue801' }
461
+ ```
462
+
463
+ :::tip
464
+ - **Text fonts**: Only `.ttf` needed → generates `fontFamily` classes
465
+ - **Icon fonts**: Need `.ttf` + `.css` → generates `fontFamily` + Unicode classes
466
+ :::
467
+
468
+ #### CommonJS Module for Custom Fonts
469
+
470
+ Use the `--module` option to generate a CommonJS module called `purgetss-fonts.js` in `./app/lib/`.
471
+
472
+ ```bash
473
+ purgetss build-fonts --module
474
+ # or
475
+ purgetss bf -m
476
+ ```
477
+
478
+ **Generated module example:**
479
+ ```javascript
480
+ // ./app/lib/purgetss.fonts.js
481
+ const icons = {
482
+ // map-icons/map-icons.css
483
+ 'mapIcon': {
484
+ 'abseiling': '\ue800',
485
+ 'accounting': '\ue801',
486
+ 'airport': '\ue802',
487
+ 'amusementPark': '\ue803',
488
+ // ...
489
+ },
490
+ // microns/microns.css
491
+ 'mu': {
492
+ 'arrowLeft': '\ue700',
493
+ 'arrowRight': '\ue701',
494
+ 'arrowUp': '\ue702',
495
+ 'arrowDown': '\ue703',
496
+ // ...
497
+ }
498
+ };
499
+ exports.icons = icons;
500
+
501
+ const families = {
502
+ // map-icons/map-icons.css
503
+ 'mapIcon': 'map-icons',
504
+ // microns/microns.css
505
+ 'mu': 'microns'
506
+ };
507
+ exports.families = families;
508
+ ```
509
+
510
+ :::tip PRO TIP: Using Filenames for Class Names and Icon Prefixes
511
+ Use the `--filename` option to apply the style's filename as both the font class name and the prefix for icon class names in `fonts.tss` and property names in `purgetss.fonts.js`.
512
+
513
+ ```bash
514
+ ./purgetss/fonts/
515
+ └─ map-icons/
516
+ └─ map.ttf
517
+ └─ mp.css
518
+ └─ microns/
519
+ └─ mic.ttf
520
+ └─ mc.css
521
+ ```
522
+
523
+ This generates:
524
+ ```css
525
+ /* fontFamily classes use the font's filename */
526
+ '.map': { font: { fontFamily: 'map-icons' } }
527
+ '.mic': { font: { fontFamily: 'microns' } }
528
+
529
+ /* Icon classes use the CSS filename as prefix */
530
+ '.mp-abseiling': { text: '\ue800', title: '\ue800' }
531
+ '.mc-arrow-left': { text: '\ue700', title: '\ue700' }
532
+ ```
533
+
534
+ Make sure the new prefix remains unique to avoid conflicts with other class prefixes.
535
+ :::
536
+
537
+ ## Utility Commands
538
+
539
+ ### `purgetss shades` (alias: `s`)
540
+
541
+ Generates shades and tints for a given color and outputs the corresponding color palette in the `config.cjs` file.
542
+
543
+ ```bash
544
+ purgetss shades [hexcode] [name] [options]
545
+ # or
546
+ purgetss s [hexcode] [name] [options]
547
+ ```
548
+
549
+ **Arguments:**
550
+ - `[hexcode]` - The base hexcode value. Omit this to create a random color.
551
+ - `[name]` - The name of the color. Omit this and a name based on the color's hue will be automatically selected.
552
+
553
+ **Options:**
554
+ - `-n, --name` - Specifies the name of the color
555
+ - `-q, --quotes` - Retains double quotes in the `config.cjs` file
556
+ - `-r, --random` - Generates shades from a random color
557
+ - `-s, --single` - Generates a single color definition
558
+ - `-t, --tailwind` - Logs the generated shades with a `tailwind.config.js` compatible structure
559
+ - `-l, --log` - Logs the generated shades instead of saving them
560
+ - `-j, --json` - Logs a JSON compatible structure for `config.json`
561
+
562
+ :::info
563
+ More than 66% of all `utilities.tss` classes are related to color properties, making a tool like `shades` a valuable addition to PurgeTSS for extending color choices!
564
+ :::
565
+
566
+ **Basic usage:**
567
+ ```bash
568
+ purgetss shades 53606b Primary
569
+ # or
570
+ purgetss s 53606b Primary
571
+
572
+ # Output: ::PurgeTSS:: "Primary" (#53606b) saved in config.cjs
573
+ ```
574
+
575
+ **Result in `config.cjs`:**
576
+ ```javascript
577
+ module.exports = {
578
+ // ...
579
+ theme: {
580
+ extend: {
581
+ colors: {
582
+ primary: {
583
+ '50': '#f4f6f7',
584
+ '100': '#e3e7ea',
585
+ '200': '#cad2d7',
586
+ '300': '#a6b3ba',
587
+ '400': '#7a8b96',
588
+ '500': '#5f707b',
589
+ '600': '#53606b',
590
+ '700': '#464f58',
591
+ '800': '#3e444c',
592
+ '900': '#373c42',
593
+ default: '#53606b'
594
+ }
595
+ }
596
+ }
597
+ }
598
+ }
599
+ ```
600
+
601
+ **Log to console instead of saving:**
602
+ ```bash
603
+ purgetss shades 53606b Primary --log
604
+ # or
605
+ purgetss s 53606b Primary -l
606
+
607
+ # Output:
608
+ # ::PurgeTSS:: "Primary" (#53606b)
609
+ # {
610
+ # colors: {
611
+ # primary: {
612
+ # '50': '#f4f6f7',
613
+ # '100': '#e3e7ea',
614
+ # ...
615
+ # default: '#53606b'
616
+ # }
617
+ # }
618
+ # }
619
+ ```
620
+
621
+ **Tailwind-compatible structure:**
622
+ ```bash
623
+ purgetss shades 000f3d --tailwind
624
+ # or
625
+ purgetss s 000f3d -t
626
+
627
+ # Output:
628
+ # ::PurgeTSS:: "Stratos" (#000f3d)
629
+ # {
630
+ # colors: {
631
+ # stratos: {
632
+ # '50': '#e5f4ff',
633
+ # '100': '#cfecff',
634
+ # ...
635
+ # '900': '#000f3d'
636
+ # }
637
+ # }
638
+ # }
639
+ ```
640
+
641
+ **Generate random color:**
642
+ ```bash
643
+ purgetss shades -rl
644
+
645
+ # Output:
646
+ # ::PurgeTSS:: "Harlequin" (#44ed20)
647
+ # {
648
+ # colors: {
649
+ # harlequin: {
650
+ # '50': '#ecffe6',
651
+ # '100': '#d5fec9',
652
+ # ...
653
+ # default: '#44ed20'
654
+ # }
655
+ # }
656
+ # }
657
+ ```
658
+
659
+ **JSON-compatible structure (for Titanium's config.json):**
660
+ ```bash
661
+ purgetss shades '#65e92c' -j
662
+ # or
663
+ purgetss s '#65e92c' -j
664
+
665
+ # Output:
666
+ # ::PurgeTSS:: "Lima" (#65e92c)
667
+ # {
668
+ # global: {
669
+ # colors: {
670
+ # lima: #65e92c,
671
+ # lima-50: #f0fee7,
672
+ # lima-100: #dcfdca,
673
+ # ...
674
+ # lima-900: #215413
675
+ # }
676
+ # }
677
+ # }
678
+ ```
679
+
680
+ :::tip
681
+ The `shades` command is the first one that writes to the `config.cjs` file. If you experience any issues, please report them!
682
+ :::
683
+
684
+ ### `purgetss color-module` (alias: `cm`)
685
+
686
+ Creates a file named `purgetss.colors.js` in the `lib` folder, which includes all the colors defined in the `config.cjs` file.
687
+
688
+ ```bash
689
+ purgetss color-module
690
+ # or
691
+ purgetss cm
692
+ ```
693
+
694
+ **Generated file example:**
695
+ ```javascript
696
+ // ./app/lib/purgetss.colors.js
697
+ module.exports = {
698
+ harlequin: {
699
+ '50': '#ecffe6',
700
+ '100': '#d5fec9',
701
+ '200': '#adfd99',
702
+ '300': '#7bf85e',
703
+ '400': '#44ed20',
704
+ '500': '#2ed40e',
705
+ '600': '#1daa06',
706
+ '700': '#19810a',
707
+ '800': '#18660e',
708
+ '900': '#175611',
709
+ default: '#44ed20'
710
+ },
711
+ primary: {
712
+ '50': '#f4f6f7',
713
+ '100': '#e3e7ea',
714
+ '200': '#cad2d7',
715
+ '300': '#a6b3ba',
716
+ '400': '#7a8b96',
717
+ '500': '#5f707b',
718
+ '600': '#53606b',
719
+ '700': '#464f58',
720
+ '800': '#3e444c',
721
+ '900': '#373c42',
722
+ default: '#53606b'
723
+ }
724
+ }
725
+ ```
726
+
727
+ **Usage in JavaScript:**
728
+ ```javascript
729
+ // In your controller
730
+ var colors = require('purgetss.colors');
731
+
732
+ // Access color palettes
733
+ var primaryColor = colors.primary.default; // '#53606b'
734
+ var primaryLight = colors.primary['200']; // '#cad2d7'
735
+ var primaryDark = colors.primary['800']; // '#3e444c'
736
+
737
+ // Use in code
738
+ $.myView.backgroundColor = colors.harlequin['500'];
739
+ $.myLabel.color = colors.primary.default;
740
+ ```
741
+
742
+ :::tip
743
+ This feature is useful if you want to use your configured colors within your app's code. By importing the `purgetss.colors.js` file, you can avoid hardcoding colors across multiple locations.
744
+ :::
745
+
746
+ ### `purgetss module` (alias: `m`)
747
+
748
+ Installs the `<Animation>` component into `app/lib/`.
749
+
750
+ ```bash
751
+ purgetss module
752
+ # or
753
+ purgetss m
754
+ ```
755
+
756
+ **What it installs:**
757
+ - `purgetss.ui.js` in `app/lib/`
758
+ - Declarative animation component
759
+ - Support for `play()`, `apply()`, `open`/`close` states, and draggable logic
760
+
761
+ See [Animation Component](animation-system.md) for usage details.
762
+
763
+ ## Maintenance Commands
764
+
765
+ ### `purgetss update` (alias: `u`)
766
+
767
+ Updates PurgeTSS to the latest version.
768
+
769
+ ```bash
770
+ purgetss update
771
+ # or
772
+ purgetss u
773
+ ```
774
+
775
+ ### `purgetss sudo-update` (alias: `su`)
776
+
777
+ Updates PurgeTSS using sudo (for systems requiring elevated permissions).
778
+
779
+ ```bash
780
+ purgetss sudo-update
781
+ # or
782
+ purgetss su
783
+ ```
784
+
785
+ :::caution
786
+ Use `sudo-update` only if standard `npm install -g` requires sudo on your system.
787
+ :::
788
+
789
+ ## Command Quick Reference
790
+
791
+ | Command | Alias | Purpose |
792
+ | ------------------------------- | ----- | ------------------------------------------- |
793
+ | `purgetss init` | `i` | Create fresh config.cjs |
794
+ | `purgetss create` | `c` | New Alloy project with PurgeTSS |
795
+ | `purgetss install-dependencies` | `id` | Install dev dependencies and VS Code config |
796
+ | `purgetss build` | `b` | Regenerate utilities.tss |
797
+ | `purgetss watch` | `w` | Toggle auto-purge |
798
+ | `purgetss icon-library` | `il` | Install icon fonts |
799
+ | `purgetss build-fonts` | `bf` | Generate custom font classes |
800
+ | `purgetss shades` | `s` | Generate color palette |
801
+ | `purgetss color-module` | `cm` | Generate JS color module |
802
+ | `purgetss module` | `m` | Install Animation component |
803
+ | `purgetss update` | `u` | Update to latest version |
804
+ | `purgetss sudo-update` | `su` | Update with sudo |
805
+
806
+ ## Advanced Usage
807
+
808
+ ### Combining Commands for New Projects
809
+
810
+ ```bash
811
+ # Create project with all bells and whistles
812
+ purgetss create 'MyApp' --dependencies --vendor=fa,mi
813
+
814
+ # This is equivalent to running:
815
+ # 1. ti config app.idprefix && ti config app.workspace - retrieves the related values
816
+ # 2. ti create -t app -p all -n "MyApp" --no-prompt --id "the-prefix-id-and-name" - creates App project
817
+ # 3. cd app.workspace/"MyApp" - changes to the newly created folder
818
+ # 4. alloy new - converts it to an Alloy Project
819
+ # 5. purgetss w - autoruns purgetss every time you compile
820
+ # 6. purgetss b - builds a new ./purgetss/styles/utilities.tss file
821
+ # 7. [--vendor=fa,mi] - copies the selected fonts, including CommonJS module into ./app/lib/
822
+ # 8. [--dependencies] - installs:
823
+ # - npm i -D tailwindcss && npx tailwindcss init
824
+ # - npm i -D eslint eslint-config-axway eslint-plugin-alloy
825
+ # - Copies: .editorconfig, eslint.config.js, tailwind.config.js
826
+ # - Creates: .vscode/extensions.json and .vscode/settings.json
827
+ # 9. Opens the project in VS Code, Sublime Text, or Finder
828
+ ```
829
+
830
+ ### Setting Up an Existing Project
831
+
832
+ ```bash
833
+ # Navigate to your existing Alloy project
834
+ cd /path/to/existing/project
835
+
836
+ # Initialize PurgeTSS
837
+ purgetss init
838
+
839
+ # Enable auto-purging on compile
840
+ purgetss watch
841
+
842
+ # Install icon fonts with CommonJS module
843
+ purgetss icon-library -v=fa,mi -m
844
+
845
+ # Install dev dependencies
846
+ purgetss install-dependencies
847
+
848
+ # Build the initial utilities.tss
849
+ purgetss build
850
+ ```
851
+
852
+ ### Quick Reference: New Project Setup Commands
853
+
854
+ ```bash
855
+ # Minimum setup
856
+ purgetss create 'MyApp'
857
+
858
+ # With icon fonts
859
+ purgetss create 'MyApp' -v=fa,mi
860
+
861
+ # Full setup with dev dependencies
862
+ purgetss create 'MyApp' -d -v=fa,mi,ms,f7
863
+
864
+ # Force overwrite existing project
865
+ purgetss create 'MyApp' -f -d -v=fa
866
+ ```
867
+
868
+ ### Safelist for Large Projects
869
+
870
+ For projects with many classes that should always be included:
871
+
872
+ ```javascript
873
+ // ./purgetss/safelist.js
874
+ exports.safelist = [
875
+ // Ti Elements
876
+ 'Label', 'Button', 'Window', 'ListView', 'TableView', 'ScrollView',
877
+ // Color palette
878
+ 'bg-indigo-50', 'bg-indigo-100', /* ... */,
879
+ 'bg-indigo-800', 'bg-indigo-900',
880
+ // Custom classes
881
+ 'btn-primary', 'card-shadow', /* ... */
882
+ ];
883
+
884
+ // ./purgetss/config.cjs
885
+ module.exports = {
886
+ purge: {
887
+ options: {
888
+ safelist: require('./safelist')
889
+ }
890
+ }
891
+ }
892
+ ```
893
+
894
+ :::tip
895
+ If you need to keep a large list of classes and elements, you can create a CommonJS module with an array of all the styles and require it in `config.cjs`. You should put the safelist inside the `purgetss` folder to keep everything organized.
896
+ :::
897
+
898
+ ### Disabling Specific Classes
899
+
900
+ To disable entire property plugins:
901
+
902
+ ```javascript
903
+ module.exports = {
904
+ purge: {
905
+ options: {
906
+ plugins: [
907
+ 'opacity', // Disable all opacity classes
908
+ 'borderRadius' // Disable all border-radius classes
909
+ ]
910
+ }
911
+ }
912
+ }
913
+ ```
914
+
915
+ This removes these classes from generation to reduce `app.tss` size.
916
+
917
+ ## Troubleshooting Commands
918
+
919
+ ### Verifying Installation
920
+
921
+ ```bash
922
+ # Check PurgeTSS version
923
+ purgetss --version
924
+
925
+ # Verify global installation
926
+ which purgetss
927
+
928
+ # List all available commands
929
+ purgetss --help
930
+ ```
931
+
932
+ ### Debug Mode
933
+
934
+ Set `purge.options.missing` to `true` in `config.cjs` to see missing classes at the end of `app.tss`:
935
+
936
+ ```javascript
937
+ module.exports = {
938
+ purge: {
939
+ options: {
940
+ missing: true // Reports missing/misspelled classes
941
+ }
942
+ }
943
+ }
944
+ ```
945
+
946
+ :::info
947
+ Set `missing` to `true` if you want to get a list of any missing or misspelled classes at the end of the `app.tss` file. This is very useful if you want to check if you forgot to add a class definition or if you forgot to remove non-existing classes from your views, especially if you have upgraded from PurgeTSS v5 to v6.
948
+ :::