@maccesar/titools 2.2.11 → 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 +106 -138
- 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/architecture-tiers.md +248 -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,231 +1,212 @@
|
|
|
1
1
|
# PurgeTSS Installation & Setup
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Installation
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
:::caution Node.js 20+ Required
|
|
8
|
-
PurgeTSS has been thoroughly tested and proven to be compatible with Node 20.0.0 or higher.
|
|
9
|
-
:::
|
|
10
|
-
|
|
11
|
-
## Upgrade Notes (v7.3.x)
|
|
12
|
-
|
|
13
|
-
- `tailwind.tss` was renamed to `utilities.tss`. Update any scripts or paths that reference the old filename.
|
|
14
|
-
- PurgeTSS validates XML syntax before processing and reports line-level errors (for example, missing `<`).
|
|
15
|
-
- `deviceInfo()` now works in both Alloy and Classic projects (no `Alloy.isTablet`/`Alloy.isHandheld` dependency).
|
|
16
|
-
- If you hit issues after upgrading, try a clean reinstall: `npm uninstall -g purgetss && npm install -g purgetss`.
|
|
17
|
-
|
|
18
|
-
## Global Installation
|
|
19
|
-
|
|
20
|
-
Install PurgeTSS globally on your machine using NPM:
|
|
5
|
+
Install PurgeTSS globally on your machine using [NPM](https://www.npmjs.com/).
|
|
21
6
|
|
|
22
7
|
```bash
|
|
23
8
|
[sudo] npm install -g purgetss
|
|
24
9
|
```
|
|
25
10
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
## Initial Project Setup
|
|
11
|
+
> **CAUTION**
|
|
12
|
+
> Node.js 20+ required.
|
|
13
|
+
> PurgeTSS requires Node 20.0.0 or higher.
|
|
31
14
|
|
|
32
|
-
|
|
33
|
-
**You only need to execute `purgetss` once within your project to automatically generate the required files and folders.**
|
|
15
|
+
## Upgrade Notes
|
|
34
16
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
### Running PurgeTSS for the First Time
|
|
17
|
+
- `utilities.tss` is the generated utilities file. Update any scripts or docs that still use the previous output filename.
|
|
18
|
+
- `deviceInfo()` now works in Alloy and Classic Titanium projects.
|
|
19
|
+
- If an upgrade behaves unexpectedly, a clean reinstall is the recommended recovery step:
|
|
39
20
|
|
|
40
21
|
```bash
|
|
41
|
-
|
|
42
|
-
purgetss
|
|
22
|
+
npm uninstall -g purgetss
|
|
23
|
+
npm install -g purgetss
|
|
43
24
|
```
|
|
44
25
|
|
|
45
|
-
|
|
26
|
+
## Run PurgeTSS the First Time
|
|
46
27
|
|
|
47
|
-
|
|
28
|
+
> **INFO**
|
|
29
|
+
> Run `purgetss` once in your project to generate the required files and folders.
|
|
30
|
+
>
|
|
31
|
+
> After that, every build parses your XML files and writes a clean `app.tss` with only the classes used in your project.
|
|
48
32
|
|
|
49
|
-
|
|
33
|
+
When you run `purgetss` for the first time in your project, it does the following:
|
|
50
34
|
|
|
51
|
-
|
|
35
|
+
### 1. Auto-run Hook
|
|
52
36
|
|
|
53
|
-
|
|
37
|
+
PurgeTSS adds a task in `alloy.jmk` to run `purgetss` every time you compile your app. Works well with `liveview`.
|
|
54
38
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
```javascript
|
|
58
|
-
task('pre:compile', function(event, logger) {
|
|
59
|
-
require('child_process').execSync('purgetss', logger.warn('::PurgeTSS:: Auto-Purging ' + event.dir.project));
|
|
60
|
-
})
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
#### 2. purgetss Folder Structure
|
|
39
|
+
### 2. `purgetss` Folder
|
|
64
40
|
|
|
65
41
|
PurgeTSS creates a `purgetss` folder at the root of your project:
|
|
66
42
|
|
|
67
43
|
```bash
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
└─ config.cjs
|
|
44
|
+
purgetss
|
|
45
|
+
└─ fonts
|
|
46
|
+
└─ styles
|
|
47
|
+
└─ definitions.css
|
|
48
|
+
└─ utilities.tss
|
|
49
|
+
└─ config.cjs
|
|
74
50
|
```
|
|
75
51
|
|
|
76
|
-
|
|
52
|
+
- `config.cjs`
|
|
77
53
|
|
|
78
|
-
|
|
79
|
-
- **`styles/utilities.tss`**: All utility classes + any custom classes from `config.cjs`
|
|
80
|
-
- **`styles/definitions.css`**: Special CSS file incorporating ALL classes from `utilities.tss`, `_app.tss`, remaining `.tss` files, and `fonts.tss`. Used by VS Code extension for IntelliSense
|
|
81
|
-
- **`fonts/`**: Directory for custom fonts (Icon, Serif, Sans-Serif, Cursive, Fantasy, Monospace). Use `purgetss build-fonts` after adding fonts
|
|
54
|
+
This is where you can customize or create new classes with your preferred spacing, colors, margin values, and more. For details, see [Customization Deep Dive](./customization-deep-dive.md).
|
|
82
55
|
|
|
83
|
-
|
|
56
|
+
- `styles`
|
|
84
57
|
|
|
85
|
-
|
|
86
|
-
**PurgeTSS will OVERWRITE your existing `app.tss` file.**
|
|
58
|
+
The `styles` folder contains the `utilities.tss` and `definitions.css` files:
|
|
87
59
|
|
|
88
|
-
|
|
60
|
+
- `utilities.tss`
|
|
89
61
|
|
|
90
|
-
|
|
62
|
+
This file includes all Tailwind-like utility classes, including any custom classes defined in `config.cjs`.
|
|
91
63
|
|
|
92
|
-
|
|
93
|
-
:::
|
|
64
|
+
- `definitions.css`
|
|
94
65
|
|
|
95
|
-
|
|
66
|
+
A CSS file combining all classes from `utilities.tss`, `_app.tss`, any `.tss` files in your project, and `fonts.tss`. Used by the [VS Code extension](#vscode-extension) for autocomplete.
|
|
96
67
|
|
|
97
|
-
|
|
68
|
+
- `fonts`
|
|
98
69
|
|
|
99
|
-
|
|
70
|
+
Place icon, serif, sans-serif, or monospace font files here. See the [`build-fonts` command](./cli-commands.md#purgetss-build-fonts-alias-bf) for instructions.
|
|
100
71
|
|
|
101
|
-
|
|
102
|
-
app
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
├── widgets/ # Optional: reusable components
|
|
110
|
-
│ └── myWidget/
|
|
111
|
-
├── config.json # Set autoStyle: false for PurgeTSS
|
|
112
|
-
└── alloy.js
|
|
113
|
-
|
|
114
|
-
./purgetss/
|
|
115
|
-
├── config.cjs # PurgeTSS theme configuration
|
|
116
|
-
└── styles/
|
|
117
|
-
└── utilities.tss # All utility classes
|
|
118
|
-
```
|
|
72
|
+
> **CAUTION**
|
|
73
|
+
> **PurgeTSS overwrites your existing `app.tss` file.**
|
|
74
|
+
>
|
|
75
|
+
> On the first run, your original `app.tss` is backed up to `_app.tss`.
|
|
76
|
+
>
|
|
77
|
+
> From this point forward, you can add, delete, or update your custom classes in `_app.tss`.
|
|
78
|
+
>
|
|
79
|
+
> Alternatively, include custom values in `config.cjs`.
|
|
119
80
|
|
|
120
|
-
|
|
81
|
+
## Example Files
|
|
121
82
|
|
|
122
|
-
|
|
123
|
-
| ----------------------- | -------------------------------------------------- | ------------ |
|
|
124
|
-
| `app/styles/app.tss` | Auto-generated by PurgeTSS with only used classes | ❌ Never edit |
|
|
125
|
-
| `app/styles/_app.tss` | Your custom styles, preserved across PurgeTSS runs | ✅ Yes |
|
|
126
|
-
| `app/styles/fonts.tss` | Auto-generated by `purgetss build-fonts` | ❌ Never edit |
|
|
127
|
-
| `./purgetss/config.cjs` | Theme configuration, custom colors, fonts | ✅ Yes |
|
|
83
|
+
To use the example files:
|
|
128
84
|
|
|
129
|
-
|
|
85
|
+
- Copy the content of `index.xml` and `app.tss` into a new Alloy project.
|
|
86
|
+
- Install Font Awesome font files with `purgetss icon-library --vendor=fontawesome`.
|
|
87
|
+
- Run `purgetss` once to generate the necessary files.
|
|
88
|
+
- Compile your app as usual.
|
|
89
|
+
- Use `liveview` for faster iteration.
|
|
130
90
|
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
"
|
|
134
|
-
|
|
135
|
-
|
|
91
|
+
```xml
|
|
92
|
+
<Alloy>
|
|
93
|
+
<Window class="bg-primary">
|
|
94
|
+
<View class="h-auto w-10/12 rounded-lg bg-white">
|
|
95
|
+
<View class="vertical m-4">
|
|
96
|
+
<ImageView class="rounded-16 mx-auto h-16 w-16" image="https://randomuser.me/api/portraits/men/43.jpg" />
|
|
136
97
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
98
|
+
<View class="vertical">
|
|
99
|
+
<Label class="text-center text-lg font-semibold text-gray-900">John W. Doe</Label>
|
|
100
|
+
<Label class="mt-0.5 text-center text-sm text-purple-600">Product Engineer</Label>
|
|
140
101
|
|
|
141
|
-
|
|
102
|
+
<View class="mt-6 w-screen">
|
|
103
|
+
<View class="horizontal ml-0">
|
|
104
|
+
<Label class="far fa-envelope mr-1 text-xs text-gray-600"></Label>
|
|
105
|
+
<Label class="text-xs text-gray-600">john@internet.com</Label>
|
|
106
|
+
</View>
|
|
142
107
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
108
|
+
<View class="horizontal mr-0">
|
|
109
|
+
<Label class="fas fa-phone-alt mr-1 text-xs text-gray-600"></Label>
|
|
110
|
+
<Label class="text-xs text-gray-600">(555) 765-4321</Label>
|
|
111
|
+
</View>
|
|
112
|
+
</View>
|
|
113
|
+
</View>
|
|
114
|
+
</View>
|
|
115
|
+
</View>
|
|
116
|
+
</Window>
|
|
117
|
+
</Alloy>
|
|
154
118
|
```
|
|
155
119
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
If you need to start with a fresh `config.cjs` file, delete the existing one and run:
|
|
161
|
-
|
|
162
|
-
```bash
|
|
163
|
-
purgetss init
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
This will create a minimal `./purgetss/config.cjs`:
|
|
167
|
-
|
|
168
|
-
```javascript
|
|
169
|
-
module.exports = {
|
|
170
|
-
purge: {
|
|
171
|
-
mode: 'all',
|
|
172
|
-
method: 'sync', // How to execute the auto-purging task: sync or async
|
|
173
|
-
|
|
174
|
-
// These options are passed directly to PurgeTSS
|
|
175
|
-
options: {
|
|
176
|
-
missing: true, // Reports missing classes
|
|
177
|
-
widgets: false, // Purges widgets too
|
|
178
|
-
safelist: [], // Array of classes to keep
|
|
179
|
-
plugins: [] // Array of properties to ignore
|
|
180
|
-
}
|
|
181
|
-
},
|
|
182
|
-
theme: {
|
|
183
|
-
extend: {}
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
:::info
|
|
189
|
-
Every section of the config file is optional, so you only need to specify what you'd like to change. Any missing sections will fall back to the default configuration.
|
|
190
|
-
:::
|
|
191
|
-
|
|
192
|
-
## Visual Studio Code Integration
|
|
193
|
-
|
|
194
|
-
For the best development experience with PurgeTSS, we recommend installing and configuring the following VS Code extensions.
|
|
195
|
-
|
|
196
|
-
### Quick Setup with install-dependencies
|
|
197
|
-
|
|
198
|
-
The fastest way to set up VS Code integration is to use the `install-dependencies` command:
|
|
199
|
-
|
|
200
|
-
```bash
|
|
201
|
-
purgetss install-dependencies
|
|
202
|
-
# or
|
|
203
|
-
purgetss id
|
|
120
|
+
```tss
|
|
121
|
+
'.bg-primary': {
|
|
122
|
+
backgroundColor: '#002359'
|
|
123
|
+
}
|
|
204
124
|
```
|
|
205
125
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
:::caution
|
|
213
|
-
This command will overwrite existing `extensions.json` and `settings.json` files. Create a backup if you want to preserve them.
|
|
214
|
-
:::
|
|
215
|
-
|
|
216
|
-
### Manual Extension Setup
|
|
126
|
+
> **INFO**
|
|
127
|
+
> After running `purgetss`, `app.tss` contains only the classes used in your XML files.
|
|
128
|
+
>
|
|
129
|
+
> Your original `app.tss` is backed up as `_app.tss`. Use that file to add, delete, or update your custom styles.
|
|
130
|
+
>
|
|
131
|
+
> Every time `purgetss` runs, it copies the content of `_app.tss` to `app.tss`.
|
|
217
132
|
|
|
218
|
-
|
|
133
|
+
```tss
|
|
134
|
+
/* PurgeTSS v7.2.7 */
|
|
135
|
+
/* Created by César Estrada */
|
|
136
|
+
/* https://github.com/macCesar/purgeTSS */
|
|
219
137
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
5. **[IntelliSense for CSS class names in HTML](https://marketplace.visualstudio.com/items?itemName=Zignd.html-css-class-completion)** - Class name completion based on your PurgeTSS definitions
|
|
138
|
+
/* _app.tss styles */
|
|
139
|
+
'.bg-primary': {
|
|
140
|
+
backgroundColor: '#002359'
|
|
141
|
+
}
|
|
225
142
|
|
|
226
|
-
|
|
143
|
+
/* Ti Elements */
|
|
144
|
+
'ImageView[platform=ios]': { hires: true }
|
|
145
|
+
'View': { width: Ti.UI.SIZE, height: Ti.UI.SIZE }
|
|
146
|
+
'Window': { backgroundColor: '#FFFFFF' }
|
|
227
147
|
|
|
228
|
-
|
|
148
|
+
/* Main Styles */
|
|
149
|
+
'.bg-white': { backgroundColor: '#ffffff' }
|
|
150
|
+
'.font-semibold': { font: { fontWeight: 'semibold' } }
|
|
151
|
+
'.h-16': { height: 64 }
|
|
152
|
+
'.h-auto': { height: Ti.UI.SIZE }
|
|
153
|
+
'.horizontal': { layout: 'horizontal' }
|
|
154
|
+
'.m-4': { top: 16, right: 16, bottom: 16, left: 16 }
|
|
155
|
+
'.ml-0': { left: 0 }
|
|
156
|
+
'.mr-0': { right: 0 }
|
|
157
|
+
'.mr-1': { right: 4 }
|
|
158
|
+
'.mt-0.5': { top: 2 }
|
|
159
|
+
'.mt-6': { top: 24 }
|
|
160
|
+
'.mx-auto': { right: null, left: null }
|
|
161
|
+
'.rounded-16': { borderRadius: 32 }
|
|
162
|
+
'.rounded-lg': { borderRadius: 8 }
|
|
163
|
+
'.text-center': { textAlign: Ti.UI.TEXT_ALIGNMENT_CENTER }
|
|
164
|
+
'.text-gray-600': { color: '#4b5563', textColor: '#4b5563' }
|
|
165
|
+
'.text-gray-900': { color: '#111827', textColor: '#111827' }
|
|
166
|
+
'.text-lg': { font: { fontSize: 18 } }
|
|
167
|
+
'.text-purple-600': { color: '#9333ea', textColor: '#9333ea' }
|
|
168
|
+
'.text-sm': { font: { fontSize: 14 } }
|
|
169
|
+
'.text-xs': { font: { fontSize: 12 } }
|
|
170
|
+
'.vertical': { layout: 'vertical' }
|
|
171
|
+
'.w-10/12': { width: '83.333334%' }
|
|
172
|
+
'.w-16': { width: 64 }
|
|
173
|
+
'.w-screen': { width: Ti.UI.FILL }
|
|
174
|
+
|
|
175
|
+
/* Default Font Awesome */
|
|
176
|
+
'.fa-envelope': { text: '\uf0e0', title: '\uf0e0' }
|
|
177
|
+
'.fa-phone-alt': { text: '\uf879', title: '\uf879' }
|
|
178
|
+
'.far': { font: { fontFamily: 'FontAwesome7Free-Regular' } }
|
|
179
|
+
'.fas': { font: { fontFamily: 'FontAwesome7Free-Solid' } }
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
More examples in the [Tailwind TSS Sample App](https://github.com/macCesar/utilities.tss-sample-app).
|
|
183
|
+
|
|
184
|
+
> **WARNING: `Label`, `Button`, and `Switch` with opposite margins**
|
|
185
|
+
> In Titanium, `Label`, `Button`, and `Switch` can stretch when opposite margins pin both sides of the same axis and the dimension is still implicit.
|
|
186
|
+
>
|
|
187
|
+
> - `mt-*` + `mb-*` or `my-*` can stretch the component vertically. Add `h-auto`.
|
|
188
|
+
> - `ml-*` + `mr-*` or `mx-*` can stretch the component horizontally. Add `w-auto`.
|
|
189
|
+
> - If margins affect both axes, use `wh-auto`.
|
|
190
|
+
>
|
|
191
|
+
> This applies to **any component whose default size is `Ti.UI.SIZE`**. If you set opposite margins on the same axis (e.g., left and right), Titanium's composite layout uses those pins to calculate the dimension instead of the content -- so the component stretches to fill its parent.
|
|
192
|
+
>
|
|
193
|
+
> ```xml
|
|
194
|
+
> <Label class="mt-2 mb-4 h-auto" text="Only content height" />
|
|
195
|
+
> <Label class="mx-4 w-auto" text="Only content width" />
|
|
196
|
+
> <Label class="m-4 wh-auto" text="Safe reset on both axes" />
|
|
197
|
+
> <Switch class="my-1 mr-2 h-auto" onChange="onChanged" />
|
|
198
|
+
> ```
|
|
199
|
+
|
|
200
|
+
> **Titanium Layout Reminder**
|
|
201
|
+
> PurgeTSS does not add Flexbox to Titanium. Use `horizontal`, `vertical`, or the default composite layout, and prefer `w-screen` instead of `w-full` when you need `Ti.UI.FILL`.
|
|
202
|
+
|
|
203
|
+
## VSCode Extension
|
|
204
|
+
|
|
205
|
+
If you're using [**Visual Studio Code**](https://code.visualstudio.com), install the [**IntelliSense for CSS class names in HTML**](https://marketplace.visualstudio.com/items?itemName=Zignd.html-css-class-completion) extension.
|
|
206
|
+
|
|
207
|
+
It provides class name completion for the `XML` class attribute based on the `definitions.css` file created by PurgeTSS.
|
|
208
|
+
|
|
209
|
+
After installing the extension, add the `xml` language to the `"HTMLLanguages"` setting and exclude any `css/html` files from the caching process by pointing `"excludeGlobPattern"` to the `./purgetss/fonts/` folder.
|
|
229
210
|
|
|
230
211
|
```json
|
|
231
212
|
{
|
|
@@ -247,156 +228,3 @@ Add this to your VS Code `settings.json`:
|
|
|
247
228
|
"html-css-class-completion.excludeGlobPattern": "**/node_modules/**,purgetss/fonts/**/*.{css,html}"
|
|
248
229
|
}
|
|
249
230
|
```
|
|
250
|
-
|
|
251
|
-
This enables:
|
|
252
|
-
- Class name completion in XML files
|
|
253
|
-
- Exclusion of generated files from caching
|
|
254
|
-
- IntelliSense based on your actual PurgeTSS configuration
|
|
255
|
-
|
|
256
|
-
### Tailwind Config for VS Code
|
|
257
|
-
|
|
258
|
-
Create or update `tailwind.config.js` at your project root for optimal IntelliSense:
|
|
259
|
-
|
|
260
|
-
```javascript
|
|
261
|
-
/** @type {import('tailwindcss').Config} */
|
|
262
|
-
module.exports = {
|
|
263
|
-
content: [
|
|
264
|
-
"./app/views/**/*.xml",
|
|
265
|
-
"./purgetss/**/*.cjs"
|
|
266
|
-
],
|
|
267
|
-
theme: {
|
|
268
|
-
extend: {}
|
|
269
|
-
},
|
|
270
|
-
plugins: []
|
|
271
|
-
}
|
|
272
|
-
```
|
|
273
|
-
|
|
274
|
-
This helps Tailwind CSS IntelliSense understand your project structure.
|
|
275
|
-
|
|
276
|
-
## LiveView Development
|
|
277
|
-
|
|
278
|
-
:::tip
|
|
279
|
-
We recommend using `liveview` to speed up testing and development time. **LiveView provides instant feedback** when you make changes to your XML files or styles.
|
|
280
|
-
:::
|
|
281
|
-
|
|
282
|
-
### Enabling LiveView
|
|
283
|
-
|
|
284
|
-
LiveView is typically enabled through Titanium's development tools. When using LiveView with PurgeTSS:
|
|
285
|
-
|
|
286
|
-
1. **Auto-purge is automatically enabled** when you run `purgetss`
|
|
287
|
-
2. Changes to XML files trigger auto-purge on next compile
|
|
288
|
-
3. LiveView reloads your app with the new styles
|
|
289
|
-
|
|
290
|
-
### LiveView with TiKit Components
|
|
291
|
-
|
|
292
|
-
If you don't see any changes reflected when changing and rebuilding a project with TiKit Components and LiveView, set the compile method to `async` in `config.cjs`:
|
|
293
|
-
|
|
294
|
-
```javascript
|
|
295
|
-
module.exports = {
|
|
296
|
-
purge: {
|
|
297
|
-
mode: 'all',
|
|
298
|
-
method: 'async' // Use async for LiveView + TiKit compatibility
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
```
|
|
302
|
-
|
|
303
|
-
### LiveView Development Workflow
|
|
304
|
-
|
|
305
|
-
**Optimal workflow with LiveView:**
|
|
306
|
-
|
|
307
|
-
1. **Enable auto-purge** (done automatically by `purgetss`)
|
|
308
|
-
2. **Set method to 'async'** if using TiKit Components
|
|
309
|
-
3. **Make changes to XML or config.cjs**
|
|
310
|
-
4. **Save file** (triggers auto-compile)
|
|
311
|
-
5. **LiveView automatically reflects changes**
|
|
312
|
-
|
|
313
|
-
**Example workflow:**
|
|
314
|
-
```bash
|
|
315
|
-
# Terminal 1: Run LiveView
|
|
316
|
-
appc run --liveview
|
|
317
|
-
|
|
318
|
-
# Terminal 2: Make changes
|
|
319
|
-
# Edit app/views/index.xml
|
|
320
|
-
# Save file - LiveView auto-reloads with new styles
|
|
321
|
-
```
|
|
322
|
-
|
|
323
|
-
### Common LiveView Issues
|
|
324
|
-
|
|
325
|
-
**Problem:** Styles not updating in LiveView
|
|
326
|
-
|
|
327
|
-
**Solutions:**
|
|
328
|
-
1. Verify `alloy.jmk` has the pre:compile task
|
|
329
|
-
2. Try `method: 'async'` in `config.cjs`
|
|
330
|
-
3. Ensure `purgetss` ran successfully (check console output)
|
|
331
|
-
4. Manually trigger compile if auto-compile isn't working
|
|
332
|
-
|
|
333
|
-
**Problem:** Changes to `config.cjs` not reflected
|
|
334
|
-
|
|
335
|
-
**Solutions:**
|
|
336
|
-
1. Run `purgetss build` manually after config changes
|
|
337
|
-
2. Check that `utilities.tss` was regenerated
|
|
338
|
-
3. Verify your config syntax is correct (no trailing commas, etc.)
|
|
339
|
-
|
|
340
|
-
## First Run Example
|
|
341
|
-
|
|
342
|
-
After running `purgetss`, here's what your generated `app.tss` will look like:
|
|
343
|
-
|
|
344
|
-
```tss
|
|
345
|
-
/* PurgeTSS v7.2.7 */
|
|
346
|
-
/* Created by César Estrada */
|
|
347
|
-
/* https://purgetss.com */
|
|
348
|
-
|
|
349
|
-
/* _app.tss styles */
|
|
350
|
-
'.my-custom-class': {
|
|
351
|
-
backgroundColor: '#002359'
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
/* Ti Elements */
|
|
355
|
-
'ImageView[platform=ios]': { hires: true }
|
|
356
|
-
'View': { width: Ti.UI.SIZE, height: Ti.UI.SIZE }
|
|
357
|
-
'Window': { backgroundColor: '#FFFFFF' }
|
|
358
|
-
|
|
359
|
-
/* Main Styles */
|
|
360
|
-
'.bg-white': { backgroundColor: '#ffffff' }
|
|
361
|
-
'.font-semibold': { font: { fontWeight: 'semibold' } }
|
|
362
|
-
'.h-16': { height: 64 }
|
|
363
|
-
'.h-auto': { height: Ti.UI.SIZE }
|
|
364
|
-
'.horizontal': { layout: 'horizontal' }
|
|
365
|
-
// ... all other classes used in your XML files
|
|
366
|
-
```
|
|
367
|
-
|
|
368
|
-
:::info
|
|
369
|
-
After running `purgetss`, you will have a new `app.tss` file with only the classes used in the XML files. Your original `app.tss` file is backed up in `_app.tss`. You can use this file to add, delete, or update any of your original styles. Every time `purgetss` runs, it will copy the content of `_app.tss` to `app.tss`.
|
|
370
|
-
:::
|
|
371
|
-
|
|
372
|
-
## Quick Start with Example Files
|
|
373
|
-
|
|
374
|
-
PurgeTSS includes example files to get you started:
|
|
375
|
-
|
|
376
|
-
1. Copy the content of `index.xml` into a new Alloy project
|
|
377
|
-
2. Install Font Awesome: `purgetss icon-library --vendor=fontawesome`
|
|
378
|
-
3. Run `purgetss` once to generate necessary files
|
|
379
|
-
4. Compile your app as usual
|
|
380
|
-
5. Use `liveview` for faster iteration
|
|
381
|
-
|
|
382
|
-
For more examples, see the [Tailwind TSS Sample App](https://github.com/macCesar/utilities.tss-sample-app).
|
|
383
|
-
|
|
384
|
-
## Troubleshooting
|
|
385
|
-
|
|
386
|
-
### PurgeTSS Not Running on Compile
|
|
387
|
-
|
|
388
|
-
Check that `alloy.jmk` exists in your project root and contains the pre:compile task. If missing, run `purgetss` again.
|
|
389
|
-
|
|
390
|
-
### Classes Not Appearing in IntelliSense
|
|
391
|
-
|
|
392
|
-
1. Ensure `definitions.css` is being generated (check `purgetss/styles/definitions.css`)
|
|
393
|
-
2. Verify VS Code extension is installed and configured
|
|
394
|
-
3. Try reloading VS Code after running `purgetss`
|
|
395
|
-
|
|
396
|
-
### Missing Classes Report
|
|
397
|
-
|
|
398
|
-
If `purge.options.missing` is set to `true`, check the end of your `app.tss` file for a list of missing or misspelled classes.
|
|
399
|
-
|
|
400
|
-
:::info
|
|
401
|
-
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.
|
|
402
|
-
:::
|