@maccesar/titools 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS-TEMPLATE.md +173 -0
- package/README.md +867 -0
- package/agents/ti-researcher.md +108 -0
- package/bin/titools.js +53 -0
- package/lib/commands/agents.js +126 -0
- package/lib/commands/install.js +188 -0
- package/lib/commands/uninstall.js +215 -0
- package/lib/commands/update.js +159 -0
- package/lib/config.js +119 -0
- package/lib/downloader.js +153 -0
- package/lib/installer.js +253 -0
- package/lib/platform.js +108 -0
- package/lib/symlink.js +142 -0
- package/lib/utils.js +270 -0
- package/package.json +67 -0
- package/skills/alloy-expert/SKILL.md +247 -0
- package/skills/alloy-expert/assets/ControllerAutoCleanup.js +182 -0
- package/skills/alloy-expert/references/alloy-structure.md +381 -0
- package/skills/alloy-expert/references/anti-patterns.md +133 -0
- package/skills/alloy-expert/references/code-conventions.md +469 -0
- package/skills/alloy-expert/references/contracts.md +280 -0
- package/skills/alloy-expert/references/controller-patterns.md +520 -0
- package/skills/alloy-expert/references/error-handling.md +484 -0
- package/skills/alloy-expert/references/examples.md +735 -0
- package/skills/alloy-expert/references/migration-patterns.md +298 -0
- package/skills/alloy-expert/references/patterns.md +448 -0
- package/skills/alloy-expert/references/performance-patterns.md +855 -0
- package/skills/alloy-expert/references/security-patterns.md +847 -0
- package/skills/alloy-expert/references/state-management.md +779 -0
- package/skills/alloy-expert/references/testing.md +872 -0
- package/skills/alloy-guides/SKILL.md +214 -0
- package/skills/alloy-guides/references/CLI_TASKS.md +243 -0
- package/skills/alloy-guides/references/CONCEPTS.md +191 -0
- package/skills/alloy-guides/references/CONTROLLERS.md +298 -0
- package/skills/alloy-guides/references/MODELS.md +1028 -0
- package/skills/alloy-guides/references/PURGETSS.md +56 -0
- package/skills/alloy-guides/references/VIEWS_DYNAMIC.md +242 -0
- package/skills/alloy-guides/references/VIEWS_STYLES.md +388 -0
- package/skills/alloy-guides/references/VIEWS_WITHOUT_CONTROLLERS.md +109 -0
- package/skills/alloy-guides/references/VIEWS_XML.md +558 -0
- package/skills/alloy-guides/references/WIDGETS.md +176 -0
- package/skills/alloy-howtos/SKILL.md +203 -0
- package/skills/alloy-howtos/references/best_practices.md +138 -0
- package/skills/alloy-howtos/references/cli_reference.md +253 -0
- package/skills/alloy-howtos/references/config_files.md +87 -0
- package/skills/alloy-howtos/references/custom_tags.md +147 -0
- package/skills/alloy-howtos/references/debugging_troubleshooting.md +101 -0
- package/skills/alloy-howtos/references/samples.md +167 -0
- package/skills/purgetss/SKILL.md +442 -0
- package/skills/purgetss/assets/purgetss.config.cjs +17 -0
- package/skills/purgetss/references/EXAMPLES.md +247 -0
- package/skills/purgetss/references/animation-system.md +1294 -0
- package/skills/purgetss/references/apply-directive.md +375 -0
- package/skills/purgetss/references/arbitrary-values.md +612 -0
- package/skills/purgetss/references/class-index.md +1350 -0
- package/skills/purgetss/references/cli-commands.md +948 -0
- package/skills/purgetss/references/configurable-properties.md +654 -0
- package/skills/purgetss/references/custom-rules.md +161 -0
- package/skills/purgetss/references/customization-deep-dive.md +722 -0
- package/skills/purgetss/references/dynamic-component-creation.md +489 -0
- package/skills/purgetss/references/grid-layout.md +455 -0
- package/skills/purgetss/references/icon-fonts.md +609 -0
- package/skills/purgetss/references/installation-setup.md +366 -0
- package/skills/purgetss/references/opacity-modifier.md +291 -0
- package/skills/purgetss/references/platform-modifiers.md +479 -0
- package/skills/purgetss/references/smart-mappings.md +42 -0
- package/skills/purgetss/references/titanium-resets.md +359 -0
- package/skills/purgetss/references/ui-ux-design.md +1526 -0
- package/skills/ti-guides/SKILL.md +94 -0
- package/skills/ti-guides/references/advanced-data-and-images.md +19 -0
- package/skills/ti-guides/references/alloy-cli-advanced.md +84 -0
- package/skills/ti-guides/references/alloy-data-mastery.md +29 -0
- package/skills/ti-guides/references/alloy-widgets-and-themes.md +19 -0
- package/skills/ti-guides/references/android-manifest.md +97 -0
- package/skills/ti-guides/references/app-distribution.md +258 -0
- package/skills/ti-guides/references/application-frameworks.md +377 -0
- package/skills/ti-guides/references/cli-reference.md +402 -0
- package/skills/ti-guides/references/coding-best-practices.md +102 -0
- package/skills/ti-guides/references/commonjs-advanced.md +134 -0
- package/skills/ti-guides/references/hello-world.md +100 -0
- package/skills/ti-guides/references/hyperloop-native-access.md +62 -0
- package/skills/ti-guides/references/javascript-primer.md +411 -0
- package/skills/ti-guides/references/reserved-words.md +36 -0
- package/skills/ti-guides/references/resources.md +183 -0
- package/skills/ti-guides/references/style-and-conventions.md +48 -0
- package/skills/ti-guides/references/tiapp-config.md +609 -0
- package/skills/ti-howtos/SKILL.md +174 -0
- package/skills/ti-howtos/references/android-platform-deep-dives.md +658 -0
- package/skills/ti-howtos/references/automation-fastlane-appium.md +95 -0
- package/skills/ti-howtos/references/buffer-codec-streams.md +140 -0
- package/skills/ti-howtos/references/cross-platform-development.md +348 -0
- package/skills/ti-howtos/references/debugging-profiling.md +543 -0
- package/skills/ti-howtos/references/extending-titanium.md +723 -0
- package/skills/ti-howtos/references/google-maps-v2.md +169 -0
- package/skills/ti-howtos/references/ios-map-kit.md +143 -0
- package/skills/ti-howtos/references/ios-platform-deep-dives.md +783 -0
- package/skills/ti-howtos/references/local-data-sources.md +301 -0
- package/skills/ti-howtos/references/location-and-maps.md +252 -0
- package/skills/ti-howtos/references/media-apis.md +210 -0
- package/skills/ti-howtos/references/notification-services.md +599 -0
- package/skills/ti-howtos/references/remote-data-sources.md +349 -0
- package/skills/ti-howtos/references/tutorials.md +502 -0
- package/skills/ti-howtos/references/using-modules.md +237 -0
- package/skills/ti-howtos/references/web-content-integration.md +307 -0
- package/skills/ti-howtos/references/webpack-build-pipeline.md +78 -0
- package/skills/ti-ui/SKILL.md +179 -0
- package/skills/ti-ui/references/accessibility-deep-dive.md +242 -0
- package/skills/ti-ui/references/animation-and-matrices.md +599 -0
- package/skills/ti-ui/references/application-structures.md +655 -0
- package/skills/ti-ui/references/custom-fonts-styling.md +579 -0
- package/skills/ti-ui/references/event-handling.md +393 -0
- package/skills/ti-ui/references/gestures.md +473 -0
- package/skills/ti-ui/references/icons-and-splash-screens.md +409 -0
- package/skills/ti-ui/references/layouts-and-positioning.md +462 -0
- package/skills/ti-ui/references/listviews-and-performance.md +619 -0
- package/skills/ti-ui/references/orientation.md +362 -0
- package/skills/ti-ui/references/platform-ui-android.md +635 -0
- package/skills/ti-ui/references/platform-ui-ios.md +469 -0
- package/skills/ti-ui/references/scrolling-views.md +252 -0
- package/skills/ti-ui/references/tableviews.md +568 -0
|
@@ -0,0 +1,609 @@
|
|
|
1
|
+
# Icon Fonts Libraries
|
|
2
|
+
|
|
3
|
+
PurgeTSS supports several icon font libraries for use in your Titanium Alloy applications.
|
|
4
|
+
|
|
5
|
+
:::tip Looking for Text Fonts?
|
|
6
|
+
For **text fonts** (Google Fonts, Roboto, Inter, etc.), see [CLI Commands → build-fonts](cli-commands.md#purgetss-build-fonts-alias-bf).
|
|
7
|
+
:::
|
|
8
|
+
|
|
9
|
+
:::info Official Icon Fonts for PurgeTSS
|
|
10
|
+
|
|
11
|
+
Previous versions of PurgeTSS included several icon font libraries such as Bootstrap Icons, Boxicons, LineIcons, and Tabler Icons. **However, adding more icon fonts was getting out of control**.
|
|
12
|
+
|
|
13
|
+
**As a result, we have decided to leave the following fonts as the official icon fonts for PurgeTSS:**
|
|
14
|
+
|
|
15
|
+
- [Font Awesome 7 Free (Highly recommended to upgrade using `purgetss il -v=fa`)](https://fontawesome.com)
|
|
16
|
+
- [Framework 7](https://framework7.io/icons/)
|
|
17
|
+
- [Material Icons](https://fonts.google.com/icons?icon.set=Material+Icons)
|
|
18
|
+
- [Material Symbols](https://fonts.google.com/icons?icon.set=Material+Symbols)
|
|
19
|
+
|
|
20
|
+
:::
|
|
21
|
+
|
|
22
|
+
## Table of Contents
|
|
23
|
+
|
|
24
|
+
- [Icon Fonts Libraries](#icon-fonts-libraries)
|
|
25
|
+
- [Table of Contents](#table-of-contents)
|
|
26
|
+
- [Installing Official Icon Fonts](#installing-official-icon-fonts)
|
|
27
|
+
- [Using Icon Fonts in XML](#using-icon-fonts-in-xml)
|
|
28
|
+
- [Font Awesome 7](#font-awesome-7)
|
|
29
|
+
- [Material Icons](#material-icons)
|
|
30
|
+
- [Material Symbols](#material-symbols)
|
|
31
|
+
- [Framework7 Icons](#framework7-icons)
|
|
32
|
+
- [Recreating Deleted Libraries](#recreating-deleted-libraries)
|
|
33
|
+
- [Step 1: Download the Libraries](#step-1-download-the-libraries)
|
|
34
|
+
- [Step 2: Place in fonts Folder](#step-2-place-in-fonts-folder)
|
|
35
|
+
- [Step 3: Run build-fonts Command](#step-3-run-build-fonts-command)
|
|
36
|
+
- [Generated fonts.tss Example](#generated-fontstss-example)
|
|
37
|
+
- [Renaming the Style Rule Name](#renaming-the-style-rule-name)
|
|
38
|
+
- [Using Custom Font Modules](#using-custom-font-modules)
|
|
39
|
+
- [Generated Module Structure](#generated-module-structure)
|
|
40
|
+
- [Usage in Controllers](#usage-in-controllers)
|
|
41
|
+
- [The --prefix Option](#the---prefix-option)
|
|
42
|
+
- [Example with Custom Prefix](#example-with-custom-prefix)
|
|
43
|
+
- [Icon Font Best Practices](#icon-font-best-practices)
|
|
44
|
+
- [1. Use Semantic Icon Names](#1-use-semantic-icon-names)
|
|
45
|
+
- [2. Combine with Styling Classes](#2-combine-with-styling-classes)
|
|
46
|
+
- [3. Use in Navigation](#3-use-in-navigation)
|
|
47
|
+
- [4. Dynamic Icons in Controllers](#4-dynamic-icons-in-controllers)
|
|
48
|
+
- [Font Assets Folder](#font-assets-folder)
|
|
49
|
+
- [Icon Sizing and Styling](#icon-sizing-and-styling)
|
|
50
|
+
- [Common Patterns](#common-patterns)
|
|
51
|
+
- [Icon with Text](#icon-with-text)
|
|
52
|
+
- [Circular Icon Button](#circular-icon-button)
|
|
53
|
+
- [Icon Badge](#icon-badge)
|
|
54
|
+
- [Social Media Icons](#social-media-icons)
|
|
55
|
+
- [Troubleshooting](#troubleshooting)
|
|
56
|
+
- [Icons Not Displaying](#icons-not-displaying)
|
|
57
|
+
- [Wrong Icon Character](#wrong-icon-character)
|
|
58
|
+
- [Icons Different on iOS vs Android](#icons-different-on-ios-vs-android)
|
|
59
|
+
- [Vendor-Specific Notes](#vendor-specific-notes)
|
|
60
|
+
- [Font Awesome 7](#font-awesome-7-1)
|
|
61
|
+
- [Font Awesome Pro](#font-awesome-pro)
|
|
62
|
+
- [Setting Up Font Awesome Pro](#setting-up-font-awesome-pro)
|
|
63
|
+
- [Pro Icon Styles](#pro-icon-styles)
|
|
64
|
+
- [Font Awesome 7 Beta](#font-awesome-7-beta)
|
|
65
|
+
- [Setting Up Font Awesome 7 Beta](#setting-up-font-awesome-7-beta)
|
|
66
|
+
- [Testing Beta Icons](#testing-beta-icons)
|
|
67
|
+
- [Material Icons vs Material Symbols](#material-icons-vs-material-symbols)
|
|
68
|
+
- [Complete Command Reference](#complete-command-reference)
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Installing Official Icon Fonts
|
|
73
|
+
|
|
74
|
+
Use the `icon-library` command to download and install official icon fonts:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
purgetss icon-library --vendor=[fa,mi,ms,f7] [options]
|
|
78
|
+
# or
|
|
79
|
+
purgetss il -v=[fa,mi,ms,f7] [options]
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Vendors:**
|
|
83
|
+
- `fa` - Font Awesome (Free version)
|
|
84
|
+
- `mi` - Material Icons
|
|
85
|
+
- `ms` - Material Symbols
|
|
86
|
+
- `f7` - Framework7 Icons
|
|
87
|
+
|
|
88
|
+
**Options:**
|
|
89
|
+
- `-m, --module` - Generates CommonJS module with Unicode mappings in `app/lib/`
|
|
90
|
+
- `-s, --styles` - Generates TSS file with class definitions
|
|
91
|
+
|
|
92
|
+
**Examples:**
|
|
93
|
+
```bash
|
|
94
|
+
# Install Font Awesome only
|
|
95
|
+
purgetss icon-library --vendor=fa
|
|
96
|
+
|
|
97
|
+
# Install multiple vendors with module
|
|
98
|
+
purgetss il -v=fa,mi,ms -m
|
|
99
|
+
|
|
100
|
+
# Install all available vendors
|
|
101
|
+
purgetss icon-library -v=fa,mi,ms,f7 -m -s
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
:::tip
|
|
105
|
+
After running `icon-library`, the font files are automatically placed in `app/assets/fonts/` and the necessary TSS classes are generated.
|
|
106
|
+
:::
|
|
107
|
+
|
|
108
|
+
## Using Icon Fonts in XML
|
|
109
|
+
|
|
110
|
+
Once installed, icon fonts work on both Labels and Buttons:
|
|
111
|
+
|
|
112
|
+
```xml
|
|
113
|
+
<!-- Works on Labels -->
|
|
114
|
+
<Label class="fas fa-home" />
|
|
115
|
+
<Label class="fab fa-twitter text-blue-400" />
|
|
116
|
+
|
|
117
|
+
<!-- Works on Buttons too! -->
|
|
118
|
+
<Button class="fas fa-search" />
|
|
119
|
+
<Button class="fas fa-arrow-right" />
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Font Awesome 7
|
|
123
|
+
|
|
124
|
+
Font Awesome 7 uses different style prefixes:
|
|
125
|
+
|
|
126
|
+
```xml
|
|
127
|
+
<!-- Solid icons (free) -->
|
|
128
|
+
<Label class="fas fa-home fa-user fa-envelope" />
|
|
129
|
+
|
|
130
|
+
<!-- Regular icons (free) -->
|
|
131
|
+
<Label class="far fa-heart fa-star" />
|
|
132
|
+
|
|
133
|
+
<!-- Brand icons (free) -->
|
|
134
|
+
<Label class="fab fa-twitter fa-facebook fa-github" />
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Material Icons
|
|
138
|
+
|
|
139
|
+
```xml
|
|
140
|
+
<Label class="material-icons md-home md-settings" />
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Material Symbols
|
|
144
|
+
|
|
145
|
+
```xml
|
|
146
|
+
<Label class="material-symbols ms-check ms-add ms-close" />
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Framework7 Icons
|
|
150
|
+
|
|
151
|
+
```xml
|
|
152
|
+
<Label class="f7-icons f7-home f7-search" />
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Recreating Deleted Libraries
|
|
156
|
+
|
|
157
|
+
If you need to use icon fonts that are no longer officially supported (Bootstrap Icons, Boxicons, LineIcons, Tabler Icons), you can recreate them using the `build-fonts` command.
|
|
158
|
+
|
|
159
|
+
### Step 1: Download the Libraries
|
|
160
|
+
|
|
161
|
+
Download the libraries from their official websites:
|
|
162
|
+
|
|
163
|
+
- [Bootstrap Icons](https://icons.getbootstrap.com)
|
|
164
|
+
- [Boxicons](https://boxicons.com)
|
|
165
|
+
- [LineIcons](https://lineicons.com/icons/?type=free)
|
|
166
|
+
- [Tabler Icons](https://tabler-icons.io)
|
|
167
|
+
|
|
168
|
+
### Step 2: Place in fonts Folder
|
|
169
|
+
|
|
170
|
+
Put the desired libraries in the `./purgetss/fonts` folder.
|
|
171
|
+
|
|
172
|
+
:::info
|
|
173
|
+
You just need to copy the **TrueType** or **OpenType** font files and the `.css` file.
|
|
174
|
+
:::
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
./purgetss/fonts/
|
|
178
|
+
├─ boxicons
|
|
179
|
+
│ ├─ boxicons.css
|
|
180
|
+
│ └─ boxicons.ttf
|
|
181
|
+
└─ lineicons
|
|
182
|
+
├─ lineicons.css
|
|
183
|
+
└─ lineicons.ttf
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Step 3: Run build-fonts Command
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
$ purgetss build-fonts [--module]
|
|
190
|
+
# alias:
|
|
191
|
+
$ purgetss bf [-m]
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
**What happens:**
|
|
195
|
+
1. Generates `./purgetss/styles/fonts.tss` with all Unicode characters and style rules
|
|
196
|
+
2. Copies font files to `./app/assets/fonts/` and renames them to PostScript names (cross-platform compatibility)
|
|
197
|
+
3. Optionally generates `./app/lib/purgetss.fonts.js` CommonJS module with `--module` option
|
|
198
|
+
|
|
199
|
+
#### Generated fonts.tss Example
|
|
200
|
+
|
|
201
|
+
```tss
|
|
202
|
+
/* ./purgetss/styles/fonts.tss */
|
|
203
|
+
'.boxicons': { font: { fontFamily: 'boxicons' } }
|
|
204
|
+
'.lineicons': { font: { fontFamily: 'LineIcons' } }
|
|
205
|
+
|
|
206
|
+
/* Unicode Characters */
|
|
207
|
+
/* To use your Icon Fonts in Buttons AND Labels each class sets 'text' and 'title' properties */
|
|
208
|
+
|
|
209
|
+
/* boxicons.css */
|
|
210
|
+
'.bxl-meta': { text: '\uef27', title: '\uef27' }
|
|
211
|
+
'.bx-lemon': { text: '\uef28', title: '\uef28' }
|
|
212
|
+
'.bxs-lemon': { text: '\uef29', title: '\uef29' }
|
|
213
|
+
|
|
214
|
+
/* lineicons.css */
|
|
215
|
+
'.lni-500px': { text: '\uea03', title: '\uea03' }
|
|
216
|
+
'.lni-add-files': { text: '\uea01', title: '\uea01' }
|
|
217
|
+
'.lni-adobe': { text: '\uea06', title: '\uea06' }
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### Renaming the Style Rule Name
|
|
221
|
+
|
|
222
|
+
**PurgeTSS** uses the font's file name as the style rule name. **You can change it by renaming the font file**.
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
./purgetss/fonts/
|
|
226
|
+
└─ boxicons
|
|
227
|
+
└─ bx.ttf # Renamed from boxicons.ttf
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
New style rule name: `'.bx'`
|
|
231
|
+
|
|
232
|
+
```tss
|
|
233
|
+
/* ./purgetss/styles/fonts.tss */
|
|
234
|
+
'.bx': { font: { fontFamily: 'boxicons' } }
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## Using Custom Font Modules
|
|
238
|
+
|
|
239
|
+
When using the `--module` option with `build-fonts` or `icon-library`, a CommonJS module is generated at `./app/lib/purgetss.fonts.js`.
|
|
240
|
+
|
|
241
|
+
### Generated Module Structure
|
|
242
|
+
|
|
243
|
+
```javascript
|
|
244
|
+
// ./app/lib/purgetss.fonts.js
|
|
245
|
+
const icons = {
|
|
246
|
+
'boxicons': {
|
|
247
|
+
'bxlMeta': '\uef27',
|
|
248
|
+
'bxLemon': '\uef28',
|
|
249
|
+
'bxsLemon': '\uef29',
|
|
250
|
+
/* ... */
|
|
251
|
+
},
|
|
252
|
+
'lineicons': {
|
|
253
|
+
'500px': '\uea03',
|
|
254
|
+
'addFiles': '\uea01',
|
|
255
|
+
'adobe': '\uea06',
|
|
256
|
+
/* ... */
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
exports.icons = icons;
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
### Usage in Controllers
|
|
263
|
+
|
|
264
|
+
```javascript
|
|
265
|
+
var icons = require('purgetss.fonts');
|
|
266
|
+
|
|
267
|
+
// Get icon unicode
|
|
268
|
+
var homeIcon = icons.fontAwesome.fasHome; // '\uf015'
|
|
269
|
+
|
|
270
|
+
// Use in Label
|
|
271
|
+
$.myLabel.text = homeIcon;
|
|
272
|
+
|
|
273
|
+
// Use in Button
|
|
274
|
+
$.myButton.title = icons.fontAwesome.fabTwitter;
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
:::tip
|
|
278
|
+
Using the module is useful when you need to dynamically set icons based on data or user actions.
|
|
279
|
+
:::
|
|
280
|
+
|
|
281
|
+
## The --prefix Option
|
|
282
|
+
|
|
283
|
+
**PurgeTSS** automatically determines the group's prefix for each icon family and class name. However, you can use the `--prefix` option to apply the style's filename as the prefix for class names in `fonts.tss` and property names in `purgetss.fonts.js`.
|
|
284
|
+
|
|
285
|
+
### Example with Custom Prefix
|
|
286
|
+
|
|
287
|
+
```bash
|
|
288
|
+
./purgetss/fonts/
|
|
289
|
+
└─ lineicons
|
|
290
|
+
└─ li.css # Renamed to use custom prefix
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
**New group prefix: `li`**
|
|
294
|
+
|
|
295
|
+
```tss
|
|
296
|
+
/* ./purgetss/styles/fonts.tss */
|
|
297
|
+
/* lineicons/li.css */
|
|
298
|
+
'.li-zoom-out': { text: '\uea02', title: '\uea02' }
|
|
299
|
+
'.li-zoom-in': { text: '\uea03', title: '\uea03' }
|
|
300
|
+
'.li-zip': { text: '\uea04', title: '\uea04' }
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
```javascript
|
|
304
|
+
/* ./app/lib/purgetss.fonts.js */
|
|
305
|
+
const icons = {
|
|
306
|
+
'li': {
|
|
307
|
+
/* ... */
|
|
308
|
+
}
|
|
309
|
+
};
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
:::danger WARNING
|
|
313
|
+
**Make sure that the new prefix remains unique to avoid conflicts with other class prefixes.**
|
|
314
|
+
:::
|
|
315
|
+
|
|
316
|
+
## Icon Font Best Practices
|
|
317
|
+
|
|
318
|
+
### 1. Use Semantic Icon Names
|
|
319
|
+
|
|
320
|
+
```xml
|
|
321
|
+
<!-- Good -->
|
|
322
|
+
<Label class="fas fa-home" />
|
|
323
|
+
<Label class="fas fa-envelope" />
|
|
324
|
+
|
|
325
|
+
<!-- Avoid - unclear what the icon is -->
|
|
326
|
+
<Label class="fas fa-icon1" />
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
### 2. Combine with Styling Classes
|
|
330
|
+
|
|
331
|
+
```xml
|
|
332
|
+
<!-- Styled icon button -->
|
|
333
|
+
<Label class="fas fa-arrow-right text-brand-600 text-xl" />
|
|
334
|
+
<Label class="fas fa-search rounded-full bg-gray-100 p-2 text-gray-600" />
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
### 3. Use in Navigation
|
|
338
|
+
|
|
339
|
+
```xml
|
|
340
|
+
<!-- Tab bar icons -->
|
|
341
|
+
<Button class="fas fa-home text-gray-400" id="homeBtn" />
|
|
342
|
+
<Button class="fas fa-user text-gray-400" id="profileBtn" />
|
|
343
|
+
<Button class="fas fa-cog text-gray-400" id="settingsBtn" />
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
### 4. Dynamic Icons in Controllers
|
|
347
|
+
|
|
348
|
+
```javascript
|
|
349
|
+
function setIconBasedOnStatus(status) {
|
|
350
|
+
var icons = require('purgetss.fonts').fontAwesome;
|
|
351
|
+
|
|
352
|
+
switch(status) {
|
|
353
|
+
case 'success':
|
|
354
|
+
$.statusIcon.text = icons.fasCheckCircle;
|
|
355
|
+
$.statusIcon.classes = ['text-green-500'];
|
|
356
|
+
break;
|
|
357
|
+
case 'error':
|
|
358
|
+
$.statusIcon.text = icons.fasExclamationCircle;
|
|
359
|
+
$.statusIcon.classes = ['text-red-500'];
|
|
360
|
+
break;
|
|
361
|
+
case 'warning':
|
|
362
|
+
$.statusIcon.text = icons.fasExclamationTriangle;
|
|
363
|
+
$.statusIcon.classes = ['text-yellow-500'];
|
|
364
|
+
break;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
## Font Assets Folder
|
|
370
|
+
|
|
371
|
+
After running `build-fonts` or `icon-library`, fonts are automatically placed in:
|
|
372
|
+
|
|
373
|
+
```bash
|
|
374
|
+
./app/assets/fonts/
|
|
375
|
+
├─ FontAwesome7Free-Solid.ttf
|
|
376
|
+
├─ FontAwesome7Brands-Regular.ttf
|
|
377
|
+
├─ MaterialIcons-Regular.ttf
|
|
378
|
+
└─ Framework7Icons.ttf
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
These fonts are renamed to their **PostScript** names to ensure cross-platform compatibility between iOS and Android.
|
|
382
|
+
|
|
383
|
+
:::info
|
|
384
|
+
PurgeTSS automatically handles the PostScript name conversion. You don't need to manually rename font files.
|
|
385
|
+
:::
|
|
386
|
+
|
|
387
|
+
## Icon Sizing and Styling
|
|
388
|
+
|
|
389
|
+
Icon fonts can be sized and styled just like any text element:
|
|
390
|
+
|
|
391
|
+
```xml
|
|
392
|
+
<!-- Size utilities -->
|
|
393
|
+
<Label class="fas fa-home text-xs" /> <!-- 12px -->
|
|
394
|
+
<Label class="fas fa-home text-sm" /> <!-- 14px -->
|
|
395
|
+
<Label class="fas fa-home text-base" /> <!-- 16px -->
|
|
396
|
+
<Label class="fas fa-home text-lg" /> <!-- 18px -->
|
|
397
|
+
<Label class="fas fa-home text-xl" /> <!-- 20px -->
|
|
398
|
+
<Label class="fas fa-home text-2xl" /> <!-- 24px -->
|
|
399
|
+
<Label class="fas fa-home text-3xl" /> <!-- 30px -->
|
|
400
|
+
<Label class="fas fa-home text-(32px)" /> <!-- Arbitrary size -->
|
|
401
|
+
|
|
402
|
+
<!-- Color utilities -->
|
|
403
|
+
<Label class="fas fa-home text-gray-500" />
|
|
404
|
+
<Label class="fas fa-home text-brand-600" />
|
|
405
|
+
<Label class="fas fa-home text-(#FF5733)" />
|
|
406
|
+
|
|
407
|
+
<!-- Background utilities -->
|
|
408
|
+
<Label class="fas fa-home rounded-full bg-white p-4 text-center" />
|
|
409
|
+
|
|
410
|
+
<!-- Transform utilities -->
|
|
411
|
+
<Label class="fas fa-arrow-right rotate-45" />
|
|
412
|
+
<Label class="fas fa-heart scale-125" />
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
## Common Patterns
|
|
416
|
+
|
|
417
|
+
### Icon with Text
|
|
418
|
+
|
|
419
|
+
```xml
|
|
420
|
+
<View class="horizontal">
|
|
421
|
+
<Label class="fas fa-envelope mr-2 text-gray-600" />
|
|
422
|
+
<Label class="text-gray-800" text="Email" />
|
|
423
|
+
</View>
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
### Circular Icon Button
|
|
427
|
+
|
|
428
|
+
```xml
|
|
429
|
+
<Label class="fas fa-plus bg-brand-500 h-12 w-12 rounded-full text-center text-xl text-white" />
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
### Icon Badge
|
|
433
|
+
|
|
434
|
+
```xml
|
|
435
|
+
<View class="relative">
|
|
436
|
+
<Label class="fas fa-bell text-xl" />
|
|
437
|
+
<Label class="fas fa-circle -right-(4) -top-(4) text-xs text-red-500" />
|
|
438
|
+
</View>
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
### Social Media Icons
|
|
442
|
+
|
|
443
|
+
```xml
|
|
444
|
+
<View class="horizontal w-screen">
|
|
445
|
+
<Label class="fab fa-twitter mr-4 text-2xl text-blue-400" />
|
|
446
|
+
<Label class="fab fa-facebook mr-4 text-2xl text-blue-600" />
|
|
447
|
+
<Label class="fab fa-instagram mr-4 text-2xl text-pink-500" />
|
|
448
|
+
<Label class="fab fa-github text-2xl text-gray-800" />
|
|
449
|
+
</View>
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
## Troubleshooting
|
|
453
|
+
|
|
454
|
+
### Icons Not Displaying
|
|
455
|
+
|
|
456
|
+
**Problem**: Icon fonts not showing in app
|
|
457
|
+
|
|
458
|
+
**Solutions:**
|
|
459
|
+
1. Ensure font files are in `app/assets/fonts/`
|
|
460
|
+
2. Check that `fonts.tss` is in `purgetss/styles/`
|
|
461
|
+
3. Verify class names match the CSS file (case-sensitive)
|
|
462
|
+
4. Run `purgetss build` to regenerate styles
|
|
463
|
+
|
|
464
|
+
### Wrong Icon Character
|
|
465
|
+
|
|
466
|
+
**Problem**: Icon displays wrong character
|
|
467
|
+
|
|
468
|
+
**Solutions:**
|
|
469
|
+
1. Check icon prefix (fas/far/fab for Font Awesome)
|
|
470
|
+
2. Verify icon name matches CSS file exactly
|
|
471
|
+
3. Ensure you're using the correct font family
|
|
472
|
+
|
|
473
|
+
### Icons Different on iOS vs Android
|
|
474
|
+
|
|
475
|
+
**Problem**: Icons look different on each platform
|
|
476
|
+
|
|
477
|
+
**Solutions:**
|
|
478
|
+
1. Ensure PostScript name conversion happened (run `build-fonts` again)
|
|
479
|
+
2. Check that font files were copied to `app/assets/fonts/`
|
|
480
|
+
3. Verify both platforms use the same font file version
|
|
481
|
+
|
|
482
|
+
## Vendor-Specific Notes
|
|
483
|
+
|
|
484
|
+
### Font Awesome 7
|
|
485
|
+
|
|
486
|
+
Font Awesome 7 introduced new CSS custom properties format. PurgeTSS v7.2+ supports this format automatically.
|
|
487
|
+
|
|
488
|
+
```xml
|
|
489
|
+
<!-- Style prefix is required -->
|
|
490
|
+
<Label class="fas fa-home" /> <!-- Solid -->
|
|
491
|
+
<Label class="far fa-heart" /> <!-- Regular -->
|
|
492
|
+
<Label class="fab fa-twitter" /> <!-- Brands -->
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
### Font Awesome Pro
|
|
496
|
+
|
|
497
|
+
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; see note below)***.
|
|
498
|
+
|
|
499
|
+
:::caution
|
|
500
|
+
Titanium cannot use FontAwesome's duotone icons because they have two separate glyphs for each individual icon.
|
|
501
|
+
:::
|
|
502
|
+
|
|
503
|
+
#### Setting Up Font Awesome Pro
|
|
504
|
+
|
|
505
|
+
**Step 1: Set up @fortawesome scope**
|
|
506
|
+
|
|
507
|
+
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:
|
|
508
|
+
|
|
509
|
+
```bash
|
|
510
|
+
npm init
|
|
511
|
+
npm install --save-dev @fortawesome/fontawesome-pro
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
**Step 2: Run purgetss build**
|
|
515
|
+
|
|
516
|
+
To generate a new `purgetss/styles/fontawesome.tss` file with Pro icons:
|
|
517
|
+
|
|
518
|
+
```bash
|
|
519
|
+
purgetss build
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
This will also automatically copy the Pro font files into `./app/assets/fonts/` if necessary.
|
|
523
|
+
|
|
524
|
+
#### Pro Icon Styles
|
|
525
|
+
|
|
526
|
+
Font Awesome Pro includes additional style prefixes beyond the free version:
|
|
527
|
+
|
|
528
|
+
```xml
|
|
529
|
+
<!-- Free styles -->
|
|
530
|
+
<Label class="fas fa-home" /> <!-- Solid (free) -->
|
|
531
|
+
<Label class="far fa-heart" /> <!-- Regular (free) -->
|
|
532
|
+
<Label class="fab fa-twitter" /> <!-- Brands (free) -->
|
|
533
|
+
|
|
534
|
+
<!-- Pro-only styles -->
|
|
535
|
+
<Label class="fal fa-camera" /> <!-- Light (Pro) -->
|
|
536
|
+
<Label class="fad fa-user" /> <!-- Duotone (Pro) - NOT SUPPORTED in Titanium -->
|
|
537
|
+
<Label class="fass fa-star" /> <!-- Sharp Solid (Pro) -->
|
|
538
|
+
<Label class="fasr fa-check" /> <!-- Sharp Regular (Pro) -->
|
|
539
|
+
<Label class="fasl fa-arrow" /> <!-- Sharp Light (Pro) -->
|
|
540
|
+
```
|
|
541
|
+
|
|
542
|
+
:::danger
|
|
543
|
+
**Duotone icons are NOT supported** in Titanium because they require two separate glyphs per icon. Using `fad` classes will not render correctly.
|
|
544
|
+
:::
|
|
545
|
+
|
|
546
|
+
### Font Awesome 7 Beta
|
|
547
|
+
|
|
548
|
+
You can generate a customized `fontawesome.tss` file from **[Font Awesome 7 Beta](https://fontawesome.com/download)** for testing purposes.
|
|
549
|
+
|
|
550
|
+
#### Setting Up Font Awesome 7 Beta
|
|
551
|
+
|
|
552
|
+
**Step 1: Copy beta assets**
|
|
553
|
+
|
|
554
|
+
Move the `css` and `webfonts` folders from the beta download:
|
|
555
|
+
|
|
556
|
+
```bash
|
|
557
|
+
# From beta download
|
|
558
|
+
fontawesome-pro-7.0.0-beta3-web/
|
|
559
|
+
└─ css
|
|
560
|
+
└─ webfonts
|
|
561
|
+
|
|
562
|
+
# To your project
|
|
563
|
+
purgetss/
|
|
564
|
+
└─ fontawesome-beta/
|
|
565
|
+
├─ css
|
|
566
|
+
└─ webfonts
|
|
567
|
+
```
|
|
568
|
+
|
|
569
|
+
**Step 2: Run purgetss build**
|
|
570
|
+
|
|
571
|
+
```bash
|
|
572
|
+
purgetss build
|
|
573
|
+
```
|
|
574
|
+
|
|
575
|
+
This generates your customized `fontawesome.tss` file with beta icons.
|
|
576
|
+
|
|
577
|
+
#### Testing Beta Icons
|
|
578
|
+
|
|
579
|
+
```xml
|
|
580
|
+
<!-- Test beta-specific icons -->
|
|
581
|
+
<Label class="fas fa-new-beta-icon" />
|
|
582
|
+
```
|
|
583
|
+
|
|
584
|
+
### Material Icons vs Material Symbols
|
|
585
|
+
|
|
586
|
+
- **Material Icons**: Older Google icon set
|
|
587
|
+
- **Material Symbols**: Newer, more customizable icon set
|
|
588
|
+
|
|
589
|
+
Both use similar syntax but have different icon names and font files.
|
|
590
|
+
|
|
591
|
+
```xml
|
|
592
|
+
<!-- Material Icons -->
|
|
593
|
+
<Label class="material-icons md-home" />
|
|
594
|
+
|
|
595
|
+
<!-- Material Symbols -->
|
|
596
|
+
<Label class="material-symbols ms-home" />
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
## Complete Command Reference
|
|
600
|
+
|
|
601
|
+
| Command | Purpose |
|
|
602
|
+
| ----------------------------------- | ----------------------------------------- |
|
|
603
|
+
| `purgetss icon-library -v=fa` | Install Font Awesome 7 |
|
|
604
|
+
| `purgetss icon-library -v=mi` | Install Material Icons |
|
|
605
|
+
| `purgetss icon-library -v=ms` | Install Material Symbols |
|
|
606
|
+
| `purgetss icon-library -v=f7` | Install Framework7 Icons |
|
|
607
|
+
| `purgetss icon-library -v=fa,mi -m` | Install multiple with module |
|
|
608
|
+
| `purgetss build-fonts` | Build custom fonts from `purgetss/fonts/` |
|
|
609
|
+
| `purgetss build-fonts -m` | Build with CommonJS module |
|