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