# purgetss > Titanium PurgeTSS utility-first styling toolkit. Use when styling, reviewing, analyzing, or examining Titanium UI with utility classes, configuring config.cjs, creating dynamic components with $.UI.create(), building animations, using grid layouts, setting up icon fonts, or working with TSS styles. Never suggest other CSS framework classes - verify in class-index.md first. - Author: Cesar Estrada - Repository: macCesar/titools - Version: 20260205112147 - Stars: 1 - Forks: 0 - Last Updated: 2026-02-06 - Source: https://github.com/macCesar/titools - Web: https://mule.run/skillshub/@@macCesar/titools~purgetss:20260205112147 --- --- name: purgetss description: "Titanium PurgeTSS utility-first styling toolkit. Use when styling, reviewing, analyzing, or examining Titanium UI with utility classes, configuring config.cjs, creating dynamic components with $.UI.create(), building animations, using grid layouts, setting up icon fonts, or working with TSS styles. Never suggest other CSS framework classes - verify in class-index.md first." argument-hint: "[class-name]" allowed-tools: Read, Grep, Glob, Edit, Write, Bash(purgetss *), Bash(node *) --- # 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:** - `purgetss/` folder - `purgetss/config.cjs` configuration file - `purgetss/styles/utilities.tss` utility classes - `app/styles/app.tss` (auto-generated) **Behavior based on detection:** - **PurgeTSS detected** → Provides PurgeTSS-specific guidance, recommends utility classes, suggests `$.UI.create()` for dynamic components - **Not detected** → Does NOT suggest PurgeTSS utility classes, does NOT recommend `$.UI.create()`, does NOT reference PurgeTSS-specific patterns ::: ## Core Workflow 1. **Setup**: `purgetss create 'name'` or `purgetss init` for existing projects 2. **Build**: Write XML with utility classes → PurgeTSS auto-generates `app.tss` 3. **Configure**: Customize via `purgetss/config.cjs` ## 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 `app.tss` vs `_app.tss` :::warning CRITICAL: app.tss IS AUTO-GENERATED **`app.tss` is ALWAYS regenerated** every time the app compiles. PurgeTSS scans ALL XMLs and Controllers for utility classes, then generates a fresh `app.tss` containing only the classes actually used. **NEVER edit `app.tss` directly** - your changes WILL be overwritten on the next build. ::: :::info THE `_app.tss` BACKUP FILE On **first run**, PurgeTSS backs up your original `app.tss` to `_app.tss`. **`_app.tss` is your custom styles file** - it persists across all PurgeTSS runs. Every build, PurgeTSS: 1. Scans XMLs and Controllers for used classes 2. Regenerates `app.tss` from scratch 3. Copies `_app.tss` content into the generated `app.tss` Better approach: define custom classes in `config.cjs` instead of `_app.tss`. ::: ### Checking for Unused/Unsupported Classes :::danger ALWAYS CHECK `app.tss` FOR ERRORS At the **end of every generated `app.tss`**, 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 `utilities.tss` (generated from PurgeTSS utilities) - Not in `_app.tss` (your custom styles) - Not in any other `.tss` file in the `styles/` folder **This means:** 1. You have a **typo** in your class name 2. You're using a class that **doesn't exist** in PurgeTSS 3. You need to **define the class** in `_app.tss` or `config.cjs` **As part of any analysis, ALWAYS check the end of `app.tss` and report any unused/unsupported classes to the user!** ::: ### How `utilities.tss` Works :::info UTILITIES.TSS REGENERATION `./purgetss/styles/utilities.tss` contains ALL available PurgeTSS utility classes. **It regenerates when `./purgetss/config.cjs` 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 `app.tss`, it means it's truly not defined anywhere - not even in your `config.cjs` 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 - `tailwind.tss` was renamed to `utilities.tss` (update any scripts or references). - XML syntax validation now runs before processing and reports line-level errors (for example, missing `<`). - `deviceInfo()` works in both Alloy and Classic (no `Alloy.isTablet`/`Alloy.isHandheld` dependency). - Node.js 20+ is required. - Font Awesome 7 is supported, including the new `--fa:` 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 `purgetss create`, the default `app/styles/app.tss` 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 `_app.tss` backup. This prevents carrying around unnecessary commented code and ensures a fresh start. ::: ## Critical Rules (Low Freedom) ### ⭐ PREFER `$.UI.create()` for Dynamic Components :::tip RECOMMENDED FOR DYNAMIC COMPONENTS When creating components dynamically in Controllers, **use `$.UI.create()` instead of `Ti.UI.create()`** 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](references/dynamic-component-creation.md) for complete guide. ::: ### 🚨 RESPECT USER FILES **NEVER delete any existing `.tss` files** (like `index.tss`, `detail.tss`) or other project files without explicit user consent. **How to handle migration to PurgeTSS:** 1. **ONLY** replace custom classes with PurgeTSS utility classes if the user explicitly requests it. 2. When requested: - Analyze the definitions in the existing `.tss` files. - Update the XML/Controller components with equivalent PurgeTSS utility classes. - **WAIT** for user confirmation before suggesting or performing any file deletion. 3. If the user prefers keeping manual `.tss` 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**: - ❌ `flex`, `flex-row`, `flex-col` - ❌ `justify-between`, `justify-center`, `justify-start`, `justify-end` - ❌ `items-center` for alignment (exists but sets `width/height: FILL`) **Use Titanium layouts instead:** - ✅ `horizontal` - Children left to right - ✅ `vertical` - Children top to bottom - ✅ Omit layout class - Defaults to `composite` (absolute positioning) :::tip CRITICAL: Understanding Layout Composition When building complex UIs, carefully choose the layout mode for each container: **`vertical`** - Stack elements top to bottom (most common): ```xml Item 1 Item 2 Item 3 ``` **`horizontal`** - Arrange elements left to right: ```xml