PurgeTSS Expert
Utility-first styling toolkit for Titanium/Alloy mobile apps.
Project Detection
:::info AUTO-DETECTS PURGETSS PROJECTS
This skill automatically detects PurgeTSS usage when invoked and provides utility-first styling guidance.
Detection occurs automatically - no manual command needed.
PurgeTSS project indicators:
- folder
- configuration file
purgetss/styles/utilities.tss
utility classes
- (auto-generated)
Behavior based on detection:
- PurgeTSS detected → Provides PurgeTSS-specific guidance, recommends utility classes, suggests for dynamic components
- Not detected → Does NOT suggest PurgeTSS utility classes, does NOT recommend , does NOT reference PurgeTSS-specific patterns
:::
Core Workflow
- Setup: or for existing projects
- Build: Write XML with utility classes → PurgeTSS auto-generates
- Configure: Customize via
Project Structure
bash
./purgetss/
├─ fonts/ # Custom font files (.ttf, .otf)
├─ styles/
│ ├─ definitions.css # For VS Code IntelliSense
│ └─ utilities.tss # All PurgeTSS utility classes (renamed from tailwind.tss in v7.3)
└─ config.cjs # Theme configuration
./app/styles/
├─ app.tss # AUTO-GENERATED - DO NOT EDIT DIRECTLY
└─ _app.tss # YOUR CUSTOM STYLES (persists across runs)
Understanding vs
:::warning CRITICAL: app.tss IS AUTO-GENERATED
is ALWAYS regenerated every time the app compiles.
PurgeTSS scans ALL XMLs and Controllers for utility classes, then generates a fresh
containing only the classes actually used.
NEVER edit directly - your changes WILL be overwritten on the next build.
:::
:::info THE
BACKUP FILE
On
first run, PurgeTSS backs up your original
to
.
is your custom styles file - it persists across all PurgeTSS runs.
Every build, PurgeTSS:
- Scans XMLs and Controllers for used classes
- Regenerates from scratch
- Copies content into the generated
Better approach: define custom classes in
instead of
.
:::
Checking for Unused/Unsupported Classes
:::danger ALWAYS CHECK
FOR ERRORS
At the
end of every generated , look for this section:
tss
// Unused or unsupported classes
// .my-typo-class
// .non-existent-utility
These are classes used in your XMLs or Controllers that have NO definition anywhere:
- Not in (generated from PurgeTSS utilities)
- Not in (your custom styles)
- Not in any other file in the folder
This means:
- You have a typo in your class name
- You're using a class that doesn't exist in PurgeTSS
- You need to define the class in or
As part of any analysis, ALWAYS check the end of and report any unused/unsupported classes to the user!
:::
How Works
:::info UTILITIES.TSS REGENERATION
./purgetss/styles/utilities.tss
contains ALL available PurgeTSS utility classes.
It regenerates when changes - this is where you define:
- Custom colors
- Custom spacing scales
- Ti Element styles
- Any project-specific utilities
If a class appears in "Unused or unsupported classes" in
, it means it's truly not defined anywhere - not even in your
customizations.
:::
Quick Start
bash
purgetss create 'MyApp' -d -v fa
# -d: Install dev dependencies (ESLint, Tailwind)
# -v: Copy icon fonts (fa, mi, ms, f7)
What's New in v7.3.x
- was renamed to (update any scripts or references).
- XML syntax validation now runs before processing and reports line-level errors (for example, missing ).
- works in both Alloy and Classic (no / dependency).
- Node.js 20+ is required.
- Font Awesome 7 is supported, including the new CSS custom properties.
- VS Code:
KevinYouu.tailwind-raw-reorder-tw4
is recommended for class ordering.
- If you hit issues after upgrading, try:
npm uninstall -g purgetss && npm install -g purgetss
.
:::tip NEW PROJECT: Clean Up Default app.tss
For new projects created with
, the default
contains a large commented template.
You can safely DELETE this file - PurgeTSS will regenerate it on the first build with only the classes you actually use, and create a clean
backup.
This prevents carrying around unnecessary commented code and ensures a fresh start.
:::
Critical Rules (Low Freedom)
⭐ PREFER for Dynamic Components
:::tip RECOMMENDED FOR DYNAMIC COMPONENTS
When creating components dynamically in Controllers,
use instead of to get full PurgeTSS utility class support:
javascript
// ✅ RECOMMENDED - Full PurgeTSS support
const view = $.UI.create('View', {
classes: ['w-screen', 'h-auto', 'bg-white', 'rounded-lg']
})
// ❌ AVOID - No PurgeTSS classes
const view = Ti.UI.createView({
width: Ti.UI.FILL,
height: Ti.UI.SIZE,
backgroundColor: '#ffffff',
borderRadius: 8
})
See Dynamic Component Creation for complete guide.
:::
🚨 RESPECT USER FILES
NEVER delete any existing files (like
,
) or other project files without explicit user consent.
How to handle migration to PurgeTSS:
- ONLY replace custom classes with PurgeTSS utility classes if the user explicitly requests it.
- When requested:
- Analyze the definitions in the existing files.
- Update the XML/Controller components with equivalent PurgeTSS utility classes.
- WAIT for user confirmation before suggesting or performing any file deletion.
- If the user prefers keeping manual files for specific styles, respect that choice and only use PurgeTSS for new or requested changes.
🚨 NO FLEXBOX - Titanium Doesn't Support It
:::danger FLEXBOX CLASSES DO NOT EXIST
The following are NOT supported:
- ❌ , ,
- ❌ , , ,
- ❌ for alignment (exists but sets )
Use Titanium layouts instead:
- ✅ - Children left to right
- ✅ - Children top to bottom
- ✅ Omit layout class - Defaults to (absolute positioning)
:::tip CRITICAL: Understanding Layout Composition
When building complex UIs, carefully choose the layout mode for each container:
- Stack elements top to bottom (most common):
xml
<ScrollView class="vertical">
<View class="mb-4">Item 1</View>
<View class="mb-4">Item 2</View>
<View>Item 3</View>
</ScrollView>
- Arrange elements left to right:
xml
<View class="horizontal w-screen">
<Label text="Left" />
<View class="w-screen" /> <!-- Spacer -->
<Label text="Right" />
</View>
(default) - Absolute positioning with
,
, etc.:
xml
<View class="h-screen w-screen">
<View class="wh-12 absolute left-0 top-0 bg-red-500" />
<View class="wh-12 absolute bottom-0 right-0 bg-blue-500" />
</View>
Common Issue: If you see elements appearing in unexpected positions (e.g., a header bar "behind" content), check if parent containers have conflicting layout modes. Each container's layout affects its direct children only.
:::
🚨 PLATFORM-SPECIFIC PROPERTIES REQUIRE MODIFIERS
:::danger CRITICAL: Platform-Specific Properties Require Modifiers
Using
or
properties WITHOUT platform modifiers causes cross-platform compilation failures.
WRONG - Adds iOS code to Android (causes failure):
tss
// ❌ BAD - Adds Ti.UI.iOS to Android project
"#mainWindow": {
statusBarStyle: Ti.UI.iOS.StatusBar.LIGHT_CONTENT
}
CORRECT - Use platform modifiers in TSS:
tss
// ✅ GOOD - Only adds to iOS
"#mainWindow[platform=ios]": {
statusBarStyle: Ti.UI.iOS.StatusBar.LIGHT_CONTENT
}
OR use PurgeTSS platform modifier classes:
xml
<!-- ✅ GOOD - Platform-specific classes -->
<Window class="ios:status-bar-light android:status-bar-dark">
Properties that ALWAYS require platform modifiers:
- iOS: , , ,
- Android: configuration
- ANY , constant
When suggesting platform-specific code:
- Check if user's project supports that platform
- ALWAYS use or TSS modifier
- OR use PurgeTSS platform classes like
For complete reference on platform modifiers, see Platform Modifiers.
:::
Other Mandatory Rules
- NO padding classes: Titanium does NOT support a native property on , , , or . Always use margins on children () to simulate internal spacing.
- View defaults to : Use / to fill space when needed.
- : To get a perfect circle, use (where XX is the width/height of the square element).
- includes size: These classes already set , , and . Do not add / unless you need to override.
- on FILL elements: Adding to a element pins it to all four edges (top, bottom, left, right). This will stretch the component vertically to fill the parent unless you explicitly add () to constrain it to its content.
- + → : If both width and height use the same scale value, prefer a single (order doesn't matter: and are equivalent).
- Use shortcuts: PurgeTSS provides a complete scale of combined width/height utilities:
- Numeric Scale: to (e.g., sets both to 64px).
- Fractions: , , up to for proportional sizing.
- Special Values: (explicit ), (), and ().
- Using these instead of separate and classes improves XML readability and reduces generated TSS size.
:::tip LAYOUT TIP: EDGE PINNING
If using margins (
) causes your
or
to stretch unexpectedly, it is due to Titanium's
Edge Pinning rule (2 opposite pins = computed dimension). Use the
class to explicitly force
behavior and prevent stretching.
:::
- NEVER add class explicitly - That's the default, use / when needed
- Arbitrary values use parentheses: , - NO square brackets
- required in for Ti Elements styling
- Classes use : , IDs use :
Common Anti-Patterns
WRONG:
xml
<View class="flex-row justify-between"> <!-- Flexbox doesn't exist -->
<View class="p-4"> <!-- No padding on Views -->
<View class="composite"> <!-- Never add composite explicitly -->
CORRECT:
xml
<View class="horizontal">
<View class="m-4"> <!-- Use margins on children -->
<View> <!-- Omit layout = composite by default -->
WRONG (Dynamic Components):
javascript
// Manual styling with Ti.UI.create()
const view = Ti.UI.createView({
width: Ti.UI.FILL,
backgroundColor: '#fff',
borderRadius: 8
})
CORRECT (Dynamic Components):
javascript
// PurgeTSS classes with $.UI.create()
const view = $.UI.create('View', {
classes: ['w-screen', 'bg-white', 'rounded-lg']
})
Class Verification Workflow
:::danger CRITICAL: VERIFY CLASSES BEFORE SUGGESTING
NEVER guess or hallucinate classes based on other CSS Frameworks knowledge!
PurgeTSS shares naming with some CSS Frameworks but has DIFFERENT classes for Titanium.
Always verify a class exists before suggesting it.
:::
Verification Steps
-
Check if it's a KNOWN anti-pattern
- See PROHIBITED Classes
- Common mistakes: , , on Views (p-* not supported on Views)
-
Check the Class Index
- See Class Index for available patterns
- Constant properties like , have dedicated classes
-
Search the project when unsure
bash
# Search for a class pattern in the project's utilities.tss
grep -E "keyboard-type-" ./purgetss/styles/utilities.tss
grep -E "return-key-type-" ./purgetss/styles/utilities.tss
grep -E "^'bg-" ./purgetss/styles/utilities.tss
-
After making changes
- Check for "Unused or unsupported classes" section at the end
- Report any typos or non-existent classes to the user
What HAS Classes vs What DOESN'T
| Has Classes in PurgeTSS | Does NOT Have Classes |
|---|
| (use attribute) |
| (use attribute) |
| (use attribute) |
| (use attribute) |
| → use |
| → use margins |
| → use |
| , | on View → use on children |
:::tip
When in doubt, prefer using the search command above to verify. It's better to spend 5 seconds verifying than suggesting a class that doesn't exist and will appear in the "unused classes" warning.
:::
Reference Guides
Load these only when needed:
Essential References
- Class Index - Quick patterns, prohibited classes, verification commands (LOAD FIRST when unsure about a class)
- Dynamic Component Creation - and for creating components in Controllers (READ FIRST for dynamic components)
Setup & Configuration
- Installation & Setup - First run, VS Code, LiveView
- CLI Commands - All commands
- Migration Guide - Migrating existing apps from manual TSS to PurgeTSS
Customization
- Deep Customization - config.cjs, colors, spacing, Ti Elements
- Custom Rules - Styling Ti Elements, IDs, classes
- Apply Directive - Extracting utility combinations
- Configurable Properties - All 80+ customizable properties
Layout & Styling
- UI/UX Design Patterns - Complete guide to mobile UI components with PurgeTSS (cards, lists, forms, buttons, navigation, modals, accessibility)
- Grid Layout System - 12-column grid, responsive layouts
- Smart Mappings - How gap, shadows, and grid work under the hood
- Arbitrary Values - Parentheses notation for custom values
- Platform Modifiers - ios:, android:, tablet:, handheld:
- Opacity Modifier - Color transparency with /50 syntax
- Titanium Resets - Default styles for Ti elements
Performance
- Performance Tips - Optimizing PurgeTSS apps (bridge crossings, ListView, animations)
Components
- TiKit UI Components - Ready-to-use Alerts, Avatars, Buttons, Cards, Tabs built with PurgeTSS
Fonts & Animations
- Icon Fonts - Font Awesome 7, Material Icons, custom icon libraries
- Animation Component - Declarative API
:::tip TEXT FONTS (Google Fonts, Roboto, etc.)
For text fonts, see CLI Commands → build-fonts.
:::
Examples
For complete WRONG vs CORRECT examples including:
- Titanium layout patterns (horizontal, vertical, composite)
- Grid with percentages
- Gap usage
- Manual .tss anti-patterns
- Dynamic component creation with and
See EXAMPLES.md and Dynamic Component Creation
Related Skills
For tasks beyond styling, use these complementary skills:
| Task | Use This Skill |
|---|
| Project architecture, services, controllers | |
| Complex UI components, ListViews, gestures | |
| Alloy MVC concepts, data binding, TSS syntax | |
| Native features (camera, location, push) | |