@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.
- package/README.md +255 -713
- package/bin/titools.js +1 -1
- package/lib/commands/update.js +5 -6
- package/lib/config.js +1 -0
- package/lib/downloader.js +10 -0
- package/package.json +1 -1
- package/skills/alloy-guides/SKILL.md +46 -48
- package/skills/alloy-guides/references/CONTROLLERS.md +4 -6
- package/skills/alloy-guides/references/MODELS.md +340 -184
- package/skills/alloy-guides/references/VIEWS_DYNAMIC.md +3 -4
- package/skills/alloy-guides/references/VIEWS_STYLES.md +44 -46
- package/skills/alloy-guides/references/VIEWS_WITHOUT_CONTROLLERS.md +4 -5
- package/skills/alloy-guides/references/VIEWS_XML.md +51 -17
- package/skills/alloy-guides/references/WIDGETS.md +1 -1
- package/skills/alloy-howtos/SKILL.md +12 -13
- package/skills/alloy-howtos/references/cli_reference.md +40 -41
- package/skills/alloy-howtos/references/samples.md +3 -4
- package/skills/purgetss/SKILL.md +369 -356
- package/skills/purgetss/references/EXAMPLES.md +24 -25
- package/skills/purgetss/references/animation-advanced.md +555 -0
- package/skills/purgetss/references/animation-system.md +395 -995
- package/skills/purgetss/references/apply-directive.md +111 -141
- package/skills/purgetss/references/arbitrary-values.md +206 -480
- package/skills/purgetss/references/class-categories.md +277 -0
- package/skills/purgetss/references/class-index.md +1 -420
- package/skills/purgetss/references/cli-commands.md +446 -556
- package/skills/purgetss/references/configurable-properties.md +163 -599
- package/skills/purgetss/references/custom-rules.md +33 -76
- package/skills/purgetss/references/customization-deep-dive.md +319 -518
- package/skills/purgetss/references/dynamic-component-creation.md +33 -37
- package/skills/purgetss/references/grid-layout.md +42 -371
- package/skills/purgetss/references/icon-fonts.md +82 -475
- package/skills/purgetss/references/installation-setup.md +159 -331
- package/skills/purgetss/references/migration-guide.md +54 -109
- package/skills/purgetss/references/opacity-modifier.md +25 -222
- package/skills/purgetss/references/performance-tips.md +2 -2
- package/skills/purgetss/references/platform-modifiers.md +21 -407
- package/skills/purgetss/references/tikit-components.md +237 -104
- package/skills/purgetss/references/titanium-resets.md +20 -21
- package/skills/purgetss/references/ui-ux-design.md +171 -1702
- package/skills/ti-api/SKILL.md +109 -0
- package/skills/ti-api/references/api-android.md +675 -0
- package/skills/ti-api/references/api-app-platform.md +636 -0
- package/skills/ti-api/references/api-core.md +764 -0
- package/skills/ti-api/references/api-data-network.md +641 -0
- package/skills/ti-api/references/api-media.md +655 -0
- package/skills/ti-api/references/api-modules-ble-bluetooth.md +657 -0
- package/skills/ti-api/references/api-modules-coremotion-urlsession.md +411 -0
- package/skills/ti-api/references/api-modules-map.md +632 -0
- package/skills/ti-api/references/api-modules-nfc.md +725 -0
- package/skills/ti-api/references/api-modules-social-misc.md +526 -0
- package/skills/ti-api/references/api-services.md +700 -0
- package/skills/ti-api/references/api-ui-android.md +499 -0
- package/skills/ti-api/references/api-ui-extras.md +702 -0
- package/skills/ti-api/references/api-ui-ios-animator.md +378 -0
- package/skills/ti-api/references/api-ui-ios.md +756 -0
- package/skills/ti-api/references/api-ui-lists.md +581 -0
- package/skills/ti-api/references/api-ui-text-input.md +607 -0
- package/skills/ti-api/references/api-ui-views.md +572 -0
- package/skills/ti-api/references/api-ui-windows-navigation.md +676 -0
- package/skills/ti-api/references/api-xml-global.md +743 -0
- package/skills/ti-expert/SKILL.md +46 -45
- package/skills/ti-expert/references/adaptive-layouts.md +414 -0
- package/skills/ti-expert/references/alloy-builtins.md +16 -20
- package/skills/ti-expert/references/alloy-structure.md +40 -42
- package/skills/ti-expert/references/anti-patterns.md +34 -0
- package/skills/ti-expert/references/code-conventions.md +5 -3
- package/skills/ti-expert/references/error-handling.md +14 -7
- package/skills/ti-expert/references/examples.md +4 -2
- package/skills/ti-expert/references/performance-optimization.md +26 -24
- package/skills/ti-expert/references/security-device.md +17 -14
- package/skills/ti-expert/references/security-fundamentals.md +60 -101
- package/skills/ti-expert/references/state-management.md +15 -14
- package/skills/ti-expert/references/testing-e2e-ci.md +30 -21
- package/skills/ti-expert/references/theming.md +12 -20
- package/skills/ti-guides/SKILL.md +13 -17
- package/skills/ti-guides/references/advanced-data-and-images.md +30 -10
- package/skills/ti-guides/references/application-frameworks.md +3 -3
- package/skills/ti-guides/references/coding-best-practices.md +31 -2
- package/skills/ti-guides/references/commonjs-advanced.md +46 -4
- package/skills/ti-guides/references/hello-world.md +9 -13
- package/skills/ti-guides/references/hyperloop-native-access.md +4 -1
- package/skills/ti-guides/references/javascript-primer.md +13 -5
- package/skills/ti-guides/references/resources.md +0 -2
- package/skills/ti-guides/references/style-and-conventions.md +1 -0
- package/skills/ti-guides/references/tiapp-config.md +0 -32
- package/skills/ti-howtos/SKILL.md +43 -45
- package/skills/ti-howtos/references/buffer-codec-streams.md +25 -3
- package/skills/ti-howtos/references/debugging-profiling.md +14 -25
- package/skills/ti-howtos/references/google-maps-v2.md +3 -3
- package/skills/ti-howtos/references/ios-map-kit.md +8 -1
- package/skills/ti-howtos/references/notification-services.md +0 -1
- package/skills/ti-howtos/references/webpack-build-pipeline.md +3 -0
- package/skills/ti-ui/SKILL.md +47 -49
- package/skills/ti-ui/references/application-structures.md +3 -2
- package/skills/ti-ui/references/orientation.md +17 -9
- package/skills/ti-ui/references/platform-ui-ios.md +63 -0
- package/skills/ti-ui/references/scrolling-views.md +39 -0
|
@@ -1,38 +1,56 @@
|
|
|
1
|
-
# PurgeTSS CLI Commands
|
|
1
|
+
# PurgeTSS CLI Commands
|
|
2
2
|
|
|
3
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
47
|
+
|
|
48
|
+
# alias:
|
|
26
49
|
purgetss i
|
|
27
50
|
```
|
|
28
51
|
|
|
29
|
-
|
|
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
|
-
|
|
56
|
-
|
|
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
|
-
|
|
82
|
+
- Enclose the project name in single or double quotes. Required.
|
|
60
83
|
|
|
61
|
-
|
|
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' [
|
|
65
|
-
|
|
66
|
-
|
|
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
|
-
|
|
70
|
-
- Project name (required) - Enclose in single or double quotes
|
|
99
|
+
### Requirements
|
|
71
100
|
|
|
72
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 '
|
|
115
|
+
ti config app.workspace 'the-full-path/to-the-workspace-folder'
|
|
88
116
|
```
|
|
89
|
-
:::
|
|
90
117
|
|
|
91
|
-
###
|
|
118
|
+
### Installing Dev Dependencies
|
|
92
119
|
|
|
93
|
-
|
|
120
|
+
Adds linting and editor support to an existing project.
|
|
94
121
|
|
|
95
122
|
```bash
|
|
96
|
-
purgetss
|
|
97
|
-
# or
|
|
98
|
-
purgetss id
|
|
99
|
-
```
|
|
123
|
+
purgetss create 'Name of the Project' [--dependencies]
|
|
100
124
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
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
|
-
|
|
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
|
-
|
|
115
|
-
|
|
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
|
-
|
|
134
|
+
Recommended VSCode extensions:
|
|
119
135
|
|
|
120
|
-
|
|
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
|
-
|
|
142
|
+
### Commands Executed Internally
|
|
123
143
|
|
|
124
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
155
|
-
|
|
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
|
-
|
|
162
|
-
This
|
|
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
|
-
|
|
160
|
+
## `icon-library` Command
|
|
168
161
|
|
|
169
|
-
|
|
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
|
-
|
|
166
|
+
|
|
167
|
+
# alias:
|
|
174
168
|
purgetss il [-v=fa,mi,ms,f7] [-m] [-s]
|
|
175
169
|
```
|
|
176
170
|
|
|
177
|
-
|
|
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
|
-
|
|
184
|
-
- `-
|
|
185
|
-
- `-
|
|
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
|
-
|
|
177
|
+
`./app/assets/fonts/`
|
|
189
178
|
```bash
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
202
|
+
### Copying Specific Font Vendors
|
|
227
203
|
|
|
228
|
-
|
|
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
|
-
|
|
231
|
-
|
|
232
|
-
-
|
|
233
|
-
-
|
|
234
|
-
-
|
|
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
|
-
|
|
224
|
+
|
|
225
|
+
# alias:
|
|
239
226
|
purgetss il -m [-v=fa,mi,ms,f7]
|
|
240
227
|
```
|
|
241
228
|
|
|
242
|
-
|
|
229
|
+
Each library includes a CommonJS module that exposes Unicode strings for the icon fonts.
|
|
243
230
|
|
|
244
|
-
|
|
231
|
+
All prefixes are stripped from their class names and camel-cased. For example:
|
|
245
232
|
|
|
246
|
-
|
|
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
|
-
|
|
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
|
-
|
|
256
|
-
|
|
257
|
-
|
|
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
|
-
|
|
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
|
-
|
|
263
|
-
Titanium cannot use
|
|
264
|
-
:::
|
|
246
|
+
> **Caution**
|
|
247
|
+
> Titanium cannot use Font Awesome duotone icons because each icon uses two glyphs.
|
|
265
248
|
|
|
266
|
-
|
|
249
|
+
### Font Awesome 7 Beta
|
|
267
250
|
|
|
268
|
-
|
|
251
|
+
To generate a custom `fontawesome.tss` file from [Font Awesome 7 Beta](https://fontawesome.com/download):
|
|
269
252
|
|
|
270
|
-
|
|
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
|
-
|
|
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
|
-
|
|
270
|
+
Then run `purgetss build` to generate your custom `fontawesome.tss` file and test the new icons.
|
|
289
271
|
|
|
290
|
-
|
|
272
|
+
### Font Example File
|
|
291
273
|
|
|
292
|
-
|
|
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
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
315
|
+
```tss
|
|
316
|
+
/* PurgeTSS v7.2.7
|
|
317
|
+
* Created by Cesar Estrada
|
|
318
|
+
* https://github.com/macCesar/purgeTSS
|
|
319
|
+
*/
|
|
336
320
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
321
|
+
/* Ti Elements */
|
|
322
|
+
'View': { width: Ti.UI.SIZE, height: Ti.UI.SIZE }
|
|
323
|
+
'Window': { backgroundColor: '#FFFFFF' }
|
|
340
324
|
|
|
341
|
-
|
|
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
|
-
|
|
342
|
+
/* Default Font Awesome */
|
|
343
|
+
'.fa': { font: { fontFamily: 'FontAwesome7Free-Solid' } }
|
|
344
|
+
'.fa-home': { text: '\uf015', title: '\uf015' }
|
|
344
345
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
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
|
-
|
|
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
|
-
|
|
393
|
-
└─
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
410
|
-
└─
|
|
411
|
-
├─
|
|
412
|
-
|
|
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
|
-
|
|
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
|
-
'.
|
|
419
|
-
|
|
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
|
-
|
|
423
|
-
|
|
424
|
-
-
|
|
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
|
-
|
|
504
|
+
Use the `--module` option to generate a CommonJS module called `purgetss.fonts.js` in `./app/lib/`.
|
|
428
505
|
|
|
429
|
-
|
|
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
|
-
|
|
510
|
+
|
|
511
|
+
# alias:
|
|
434
512
|
purgetss bf -m
|
|
435
513
|
```
|
|
436
514
|
|
|
437
|
-
|
|
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
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
// ...
|
|
519
|
+
mapIcon: {
|
|
520
|
+
abseiling: '\ue800',
|
|
521
|
+
accounting: '\ue801',
|
|
522
|
+
airport: '\ue802',
|
|
523
|
+
amusementPark: '\ue803'
|
|
448
524
|
},
|
|
449
525
|
// microns/microns.css
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
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
|
-
|
|
537
|
+
mapIcon: 'map-icons',
|
|
463
538
|
// microns/microns.css
|
|
464
|
-
|
|
539
|
+
mu: 'microns'
|
|
465
540
|
};
|
|
466
541
|
exports.families = families;
|
|
467
542
|
```
|
|
468
543
|
|
|
469
|
-
|
|
470
|
-
|
|
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
|
-
|
|
474
|
-
└─
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
└─
|
|
478
|
-
└─
|
|
479
|
-
|
|
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
|
-
|
|
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
|
-
/*
|
|
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
|
|
494
|
-
:::
|
|
495
|
-
|
|
496
|
-
## Utility Commands
|
|
576
|
+
Make sure the new prefix is unique and does not conflict with other class prefixes.
|
|
497
577
|
|
|
498
|
-
|
|
578
|
+
## `shades` Command
|
|
499
579
|
|
|
500
|
-
|
|
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]
|
|
504
|
-
|
|
505
|
-
|
|
583
|
+
purgetss shades [hexcode] [name]
|
|
584
|
+
|
|
585
|
+
# alias:
|
|
586
|
+
purgetss s [hexcode] [name]
|
|
506
587
|
```
|
|
507
588
|
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
- `[
|
|
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
|
-
|
|
513
|
-
- `-
|
|
514
|
-
- `-
|
|
515
|
-
- `-
|
|
516
|
-
- `-
|
|
517
|
-
- `-
|
|
518
|
-
- `-
|
|
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
|
-
|
|
522
|
-
More than 66% of
|
|
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
|
-
#
|
|
612
|
+
# alias:
|
|
613
|
+
purgetss s 53606b Primary
|
|
532
614
|
```
|
|
533
615
|
|
|
534
|
-
|
|
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
|
-
|
|
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
|
-
#
|
|
567
|
-
|
|
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
|
-
|
|
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
|
-
#
|
|
587
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
#
|
|
625
|
-
|
|
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
|
-
|
|
640
|
-
The `shades` command is the first one that writes to
|
|
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
|
-
|
|
679
|
+
## `color-module` Command
|
|
644
680
|
|
|
645
|
-
|
|
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
|
-
|
|
685
|
+
|
|
686
|
+
# alias:
|
|
650
687
|
purgetss cm
|
|
651
688
|
```
|
|
652
689
|
|
|
653
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
719
|
+
# alias:
|
|
720
|
+
purgetss b
|
|
721
|
+
```
|
|
721
722
|
|
|
722
|
-
|
|
723
|
+
When `purgetss` runs (manually or via `watch`), it checks for changes in `config.cjs` and regenerates `utilities.tss` when needed.
|
|
723
724
|
|
|
724
|
-
|
|
725
|
+
## `watch` Command
|
|
725
726
|
|
|
726
|
-
|
|
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
|
|
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
|
-
|
|
739
|
-
purgetss
|
|
740
|
-
# or
|
|
741
|
-
purgetss su
|
|
732
|
+
# alias:
|
|
733
|
+
purgetss w
|
|
742
734
|
```
|
|
743
735
|
|
|
744
|
-
|
|
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
|
-
|
|
738
|
+
The command installs a task in `alloy.jmk`:
|
|
749
739
|
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
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
|
-
|
|
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
|
-
|
|
749
|
+
To deactivate it, use `--off`.
|
|
768
750
|
|
|
769
751
|
```bash
|
|
770
|
-
|
|
771
|
-
purgetss create 'MyApp' --dependencies --vendor=fa,mi
|
|
752
|
+
purgetss watch --off
|
|
772
753
|
|
|
773
|
-
#
|
|
774
|
-
|
|
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
|
-
|
|
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
|
-
|
|
760
|
+
The `module` command installs `purgetss.ui.js` in the `lib` folder.
|
|
812
761
|
|
|
813
762
|
```bash
|
|
814
|
-
|
|
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
|
-
#
|
|
824
|
-
purgetss
|
|
765
|
+
# alias:
|
|
766
|
+
purgetss m
|
|
825
767
|
```
|
|
826
768
|
|
|
827
|
-
|
|
769
|
+
The PurgeTSS module includes:
|
|
828
770
|
|
|
829
|
-
|
|
771
|
+
- Animation: Methods for playing or applying basic animations and transformations to Alloy objects.
|
|
830
772
|
|
|
831
|
-
|
|
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
|
-
|
|
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
|
-
|
|
777
|
+
The `update` command upgrades PurgeTSS to the latest version.
|
|
858
778
|
|
|
859
|
-
|
|
779
|
+
```bash
|
|
780
|
+
purgetss update
|
|
860
781
|
|
|
861
|
-
|
|
862
|
-
|
|
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
|
-
|
|
786
|
+
Runs `npm install -g purgetss@latest`.
|
|
875
787
|
|
|
876
|
-
##
|
|
788
|
+
## `sudo-update` Command
|
|
877
789
|
|
|
878
|
-
|
|
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
|
-
|
|
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
|
-
|
|
896
|
-
|
|
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
|
-
:::
|