purgetss
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePurgeTSS Expert
PurgeTSS 专家指南
Utility-first styling toolkit for Titanium/Alloy mobile apps.
适用于Titanium/Alloy移动应用的优先实用类样式工具包。
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
purgetss/ - configuration file
purgetss/config.cjs - utility classes
purgetss/styles/utilities.tss - (auto-generated)
app/styles/app.tss
Behavior based on detection:
- PurgeTSS detected → Provides PurgeTSS-specific guidance, recommends utility classes, suggests for dynamic components
$.UI.create() - Not detected → Does NOT suggest PurgeTSS utility classes, does NOT recommend , does NOT reference PurgeTSS-specific patterns :::
$.UI.create()
:::info 自动检测PurgeTSS项目
调用本技能时会自动检测PurgeTSS的使用情况,并提供优先实用类的样式指导。
检测自动进行 - 无需手动命令。
PurgeTSS项目标识:
- 文件夹
purgetss/ - 配置文件
purgetss/config.cjs - 实用类
purgetss/styles/utilities.tss - (自动生成)
app/styles/app.tss
基于检测结果的行为:
- 检测到PurgeTSS → 提供PurgeTSS专属指导,推荐实用类,建议使用创建动态组件
$.UI.create() - 未检测到 → 不建议使用PurgeTSS实用类,不推荐,不引用PurgeTSS专属模式 :::
$.UI.create()
Core Workflow
核心工作流程
- Setup: or
purgetss create 'name'for existing projectspurgetss init - Build: Write XML with utility classes → PurgeTSS auto-generates
app.tss - Configure: Customize via
purgetss/config.cjs
- 设置:对于新项目使用,现有项目使用
purgetss create 'name'purgetss init - 构建:编写带实用类的XML → PurgeTSS自动生成
app.tss - 配置:通过进行自定义
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)bash
./purgetss/
├─ fonts/ # 自定义字体文件(.ttf, .otf)
├─ styles/
│ ├─ definitions.css # 用于VS Code智能提示
│ └─ utilities.tss # 所有PurgeTSS实用类(v7.3中从tailwind.tss重命名而来)
└─ config.cjs # 主题配置
./app/styles/
├─ app.tss # 自动生成 - 请勿直接编辑
└─ _app.tss # 你的自定义样式(在多次运行中保留)Understanding app.tss
vs _app.tss
app.tss_app.tss理解app.tss
与_app.tss
的区别
app.tss_app.tss:::warning CRITICAL: app.tss IS AUTO-GENERATED
is ALWAYS regenerated every time the app compiles.
app.tssPurgeTSS scans ALL XMLs and Controllers for utility classes, then generates a fresh containing only the classes actually used.
app.tssNEVER edit directly - your changes WILL be overwritten on the next build.
:::
app.tss:::info THE BACKUP FILE
On first run, PurgeTSS backs up your original to .
_app.tssapp.tss_app.tss_app.tssEvery build, PurgeTSS:
- Scans XMLs and Controllers for used classes
- Regenerates from scratch
app.tss - Copies content into the generated
_app.tssapp.tss
Better approach: define custom classes in instead of .
:::
config.cjs_app.tss:::warning 重要提示:app.tss为自动生成
每次应用编译时都会重新生成。
app.tssPurgeTSS会扫描所有XML和控制器中的实用类,然后生成仅包含实际使用类的全新。
app.tss切勿直接编辑 - 你的修改会在下次构建时被覆盖。
:::
app.tss:::info _app.tss备份文件
在首次运行时,PurgeTSS会将你原有的备份到。
app.tss_app.tss_app.tss每次构建时,PurgeTSS会:
- 扫描XML和控制器中使用的类
- 从头重新生成
app.tss - 将的内容复制到生成的
_app.tss中app.tss
更好的方式:在中定义自定义类,而非。
:::
config.cjs_app.tssChecking for Unused/Unsupported Classes
检查未使用/不支持的类
:::danger ALWAYS CHECK FOR ERRORS
At the end of every generated , look for this section:
app.tssapp.tsstss
// Unused or unsupported classes
// .my-typo-class
// .non-existent-utilityThese are classes used in your XMLs or Controllers that have NO definition anywhere:
- Not in (generated from PurgeTSS utilities)
utilities.tss - Not in (your custom styles)
_app.tss - Not in any other file in the
.tssfolderstyles/
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
_app.tssconfig.cjs
As part of any analysis, ALWAYS check the end of and report any unused/unsupported classes to the user!
:::
app.tss:::danger 务必检查app.tss中的错误
在每个生成的的末尾,会有如下部分:
app.tsstss
// Unused or unsupported classes
// .my-typo-class
// .non-existent-utility这些是你在XML或控制器中使用,但在任何地方都没有定义的类:
- 不在中(由PurgeTSS实用类生成)
utilities.tss - 不在中(你的自定义样式)
_app.tss - 不在文件夹中的其他
styles/文件里.tss
这意味着:
- 你的类名存在拼写错误
- 你使用了PurgeTSS中不存在的类
- 你需要在或
_app.tss中定义该类config.cjs
作为分析的一部分,务必检查的末尾,并向用户报告所有未使用/不支持的类!
:::
app.tssHow utilities.tss
Works
utilities.tssutilities.tss的工作原理
:::info UTILITIES.TSS REGENERATION
contains ALL available PurgeTSS utility classes.
./purgetss/styles/utilities.tssIt regenerates when changes - this is where you define:
./purgetss/config.cjs- 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.
:::
app.tssconfig.cjs:::info utilities.tss的重新生成
包含所有可用的PurgeTSS实用类。
./purgetss/styles/utilities.tss当更改时,它会重新生成 - 你可以在该配置文件中定义:
./purgetss/config.cjs- 自定义颜色
- 自定义间距比例
- Ti元素样式
- 任何项目专属的实用类
如果某个类出现在的“未使用或不支持的类”部分,说明它确实在任何地方都没有定义——甚至不在你的自定义配置中。
:::
app.tssconfig.cjsQuick Start
快速开始
bash
purgetss create 'MyApp' -d -v fabash
purgetss create 'MyApp' -d -v fa-d: Install dev dependencies (ESLint, Tailwind)
-d: 安装开发依赖(ESLint, Tailwind)
-v: Copy icon fonts (fa, mi, ms, f7)
-v: 复制图标字体(fa, mi, ms, f7)
undefinedundefinedWhat's New in v7.3.x
v7.3.x版本新特性
- was renamed to
tailwind.tss(update any scripts or references).utilities.tss - XML syntax validation now runs before processing and reports line-level errors (for example, missing ).
< - works in both Alloy and Classic (no
deviceInfo()/Alloy.isTabletdependency).Alloy.isHandheld - Node.js 20+ is required.
- Font Awesome 7 is supported, including the new CSS custom properties.
--fa: - VS Code: is recommended for class ordering.
KevinYouu.tailwind-raw-reorder-tw4 - 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.
purgetss createapp/styles/app.tssYou 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.
_app.tssThis prevents carrying around unnecessary commented code and ensures a fresh start.
:::
- 重命名为
tailwind.tss(请更新所有相关脚本和引用)。utilities.tss - XML语法验证现在会在处理前运行,并报告行级错误(例如,缺失)。
< - 在Alloy和Classic模式下均可工作(不再依赖
deviceInfo()/Alloy.isTablet)。Alloy.isHandheld - 需要Node.js 20+版本。
- 支持Font Awesome 7,包括新的CSS自定义属性。
--fa: - VS Code推荐使用扩展进行类排序。
KevinYouu.tailwind-raw-reorder-tw4 - 如果升级后遇到问题,尝试执行:。
npm uninstall -g purgetss && npm install -g purgetss
:::tip 新项目:清理默认app.tss
使用创建的新项目中,默认的包含大量注释模板。
purgetss createapp/styles/app.tss你可以安全地删除该文件 - PurgeTSS会在首次构建时重新生成它,仅包含你实际使用的类,并创建干净的备份。
_app.tss这样可以避免携带不必要的注释代码,确保全新的开始。
:::
Critical Rules (Low Freedom)
关键规则(严格遵守)
⭐ PREFER $.UI.create()
for Dynamic Components
$.UI.create()⭐ 优先使用$.UI.create()
创建动态组件
$.UI.create():::tip RECOMMENDED FOR DYNAMIC COMPONENTS
When creating components dynamically in Controllers, use instead of to get full PurgeTSS utility class support:
$.UI.create()Ti.UI.create()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.
:::
:::tip 推荐用于动态组件
在控制器中动态创建组件时,请使用而非,以获得完整的PurgeTSS实用类支持:
$.UI.create()Ti.UI.create()javascript
// ✅ 推荐 - 完整支持PurgeTSS
const view = $.UI.create('View', {
classes: ['w-screen', 'h-auto', 'bg-white', 'rounded-lg']
})
// ❌ 避免 - 不支持PurgeTSS类
const view = Ti.UI.createView({
width: Ti.UI.FILL,
height: Ti.UI.SIZE,
backgroundColor: '#ffffff',
borderRadius: 8
})完整指南请参见动态组件创建。
:::
🚨 RESPECT USER FILES
🚨 尊重用户文件
NEVER delete any existing files (like , ) or other project files without explicit user consent.
.tssindex.tssdetail.tssHow 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.
.tss - Update the XML/Controller components with equivalent PurgeTSS utility classes.
- WAIT for user confirmation before suggesting or performing any file deletion.
- Analyze the definitions in the existing
- If the user prefers keeping manual files for specific styles, respect that choice and only use PurgeTSS for new or requested changes.
.tss
未经用户明确同意,切勿删除任何现有的文件(如、)或其他项目文件。
.tssindex.tssdetail.tss迁移到PurgeTSS的处理方式:
- 仅在用户明确要求时,才将自定义类替换为PurgeTSS实用类。
- 当用户提出请求时:
- 分析现有文件中的定义。
.tss - 用等效的PurgeTSS实用类更新XML/控制器组件。
- 等待用户确认后,再建议或执行任何文件删除操作。
- 分析现有
- 如果用户偏好为特定样式保留手动文件,请尊重该选择,仅在新内容或用户要求的更改中使用PurgeTSS。
.tss
🚨 NO FLEXBOX - Titanium Doesn't Support It
🚨 不支持Flexbox - Titanium不兼容
:::danger FLEXBOX CLASSES DO NOT EXIST
The following are NOT supported:
- ❌ ,
flex,flex-rowflex-col - ❌ ,
justify-between,justify-center,justify-startjustify-end - ❌ for alignment (exists but sets
items-center)width/height: FILL
Use Titanium layouts instead:
- ✅ - Children left to right
horizontal - ✅ - Children top to bottom
vertical - ✅ Omit layout class - Defaults to (absolute positioning)
composite
:::tip CRITICAL: Understanding Layout Composition
When building complex UIs, carefully choose the layout mode for each container:
verticalxml
<ScrollView class="vertical">
<View class="mb-4">Item 1</View>
<View class="mb-4">Item 2</View>
<View>Item 3</View>
</ScrollView>horizontalxml
<View class="horizontal w-screen">
<Label text="Left" />
<View class="w-screen" /> <!-- Spacer -->
<Label text="Right" />
</View>compositetopleftxml
<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.
:::
:::danger Flexbox类不存在
以下内容不被支持:
- ❌ ,
flex,flex-rowflex-col - ❌ ,
justify-between,justify-center,justify-startjustify-end - ❌ 用于对齐(虽存在但会设置
items-center)width/height: FILL
请使用Titanium布局替代:
- ✅ - 子元素从左到右排列
horizontal - ✅ - 子元素从上到下排列
vertical - ✅ 省略布局类 - 默认使用(绝对定位)
composite
:::tip 重要提示:理解布局组合
构建复杂UI时,请仔细为每个容器选择布局模式:
verticalxml
<ScrollView class="vertical">
<View class="mb-4">项目1</View>
<View class="mb-4">项目2</View>
<View>项目3</View>
</ScrollView>horizontalxml
<View class="horizontal w-screen">
<Label text="左侧" />
<View class="w-screen" /> <!-- 占位符 -->
<Label text="右侧" />
</View>compositetopleftxml
<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>常见问题: 如果元素出现在意外位置(例如,标题栏“在”内容后面),请检查父容器是否有冲突的布局模式。每个容器的布局仅影响其直接子元素。
:::
🚨 PLATFORM-SPECIFIC PROPERTIES REQUIRE MODIFIERS
🚨 平台专属属性需要修饰符
:::danger CRITICAL: Platform-Specific Properties Require Modifiers
Using or properties WITHOUT platform modifiers causes cross-platform compilation failures.
Ti.UI.iOS.*Ti.UI.Android.*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: ,
statusBarStyle,modalStyle,modalTransitionStylesystemButton - Android: configuration
actionBar - ANY ,
Ti.UI.iOS.*constantTi.UI.Android.*
When suggesting platform-specific code:
- Check if user's project supports that platform
- ALWAYS use or
[platform=ios]TSS modifier[platform=android] - OR use PurgeTSS platform classes like
ios:bg-blue-500
For complete reference on platform modifiers, see Platform Modifiers.
:::
:::danger 重要提示:平台专属属性需要修饰符
使用或属性如果不添加平台修饰符,会导致跨平台编译失败。
Ti.UI.iOS.*Ti.UI.Android.*错误示例 - 向Android项目添加iOS代码(导致失败):
tss
// ❌ 错误 - 向Android项目添加Ti.UI.iOS代码
"#mainWindow": {
statusBarStyle: Ti.UI.iOS.StatusBar.LIGHT_CONTENT
}正确示例 - 在TSS中使用平台修饰符:
tss
// ✅ 正确 - 仅添加到iOS
"#mainWindow[platform=ios]": {
statusBarStyle: Ti.UI.iOS.StatusBar.LIGHT_CONTENT
}或使用PurgeTSS平台修饰符类:
xml
<!-- ✅ 正确 - 平台专属类 -->
<Window class="ios:status-bar-light android:status-bar-dark">始终需要平台修饰符的属性:
- iOS: ,
statusBarStyle,modalStyle,modalTransitionStylesystemButton - Android: 配置
actionBar - 任何、
Ti.UI.iOS.*常量Ti.UI.Android.*
建议平台专属代码时:
- 检查用户项目是否支持该平台
- 务必使用或
[platform=ios]TSS修饰符[platform=android] - 或使用PurgeTSS平台类,如
ios:bg-blue-500
平台修饰符的完整参考请参见 平台修饰符。
:::
Other Mandatory Rules
其他强制规则
- NO padding classes: Titanium does NOT support a native
p-property onpadding,View,Window, orScrollView. Always use margins on children (TableView) to simulate internal spacing.m- - View defaults to : Use
SIZE/w-screento fill space when needed.h-screen - : To get a perfect circle, use
rounded-full(where XX is the width/height of the square element).rounded-full-XX - includes size: These classes already set
rounded-full-XX,width, andheight. Do not addborderRadius/w-XX h-XXunless you need to override.wh-XX - on FILL elements: Adding
m-xxto am-4element pins it to all four edges (top, bottom, left, right). This will stretch the component vertically to fill the parent unless you explicitly addw-screen(h-auto) to constrain it to its content.Ti.UI.SIZE - +
w-XX→h-XX: If both width and height use the same scale value, prefer a singlewh-XX(order doesn't matter:wh-XXandw-10 h-10are equivalent).h-10 w-10 - Use shortcuts: PurgeTSS provides a complete scale of combined width/height utilities:
wh-- Numeric Scale: to
wh-0(e.g.,wh-96sets both to 64px).wh-16 - Fractions: ,
wh-1/2, up towh-3/4for proportional sizing.wh-11/12 - Special Values: (explicit
wh-auto),SIZE(wh-full), and100%(wh-screen).FILL - Using these instead of separate and
w-classes improves XML readability and reduces generated TSS size.h-
- Numeric Scale:
:::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.
:::
m-LabelButtonwh-autoSIZE- NEVER add class explicitly - That's the default, use
composite/horizontalwhen neededvertical - Arbitrary values use parentheses: ,
w-(100px)- NO square bracketsbg-(#ff0000) - required in
mode: 'all'for Ti Elements stylingconfig.cjs - Classes use :
kebab-case, IDs use.my-class:camelCase#myId
- 禁止使用内边距类:Titanium在
p-、View、Window或ScrollView上不支持原生TableView属性。请始终使用子元素的外边距(padding)来模拟内部间距。m- - View默认尺寸为:需要填充空间时使用
SIZE/w-screen。h-screen - :要实现完美圆形,请使用
rounded-full(XX为方形元素的宽/高)。rounded-full-XX - 包含尺寸设置:这些类已设置
rounded-full-XX、width和height。除非需要覆盖,否则请勿添加borderRadius/w-XX h-XX。wh-XX - FILL元素上的:向
m-xx元素添加w-screen会将其固定到四个边缘(上、下、左、右)。除非你显式添加m-4(h-auto)来限制其仅适应内容,否则这会垂直拉伸组件以填充父容器。Ti.UI.SIZE - +
w-XX→h-XX:如果宽度和高度使用相同的比例值,优先使用单个wh-XX(顺序无关:wh-XX和w-10 h-10等效)。h-10 w-10 - 使用快捷类:PurgeTSS提供完整的宽高组合实用类:
wh-- 数值比例:到
wh-0(例如,wh-96将宽和高都设置为64px)。wh-16 - 分数比例:、
wh-1/2,最高到wh-3/4用于比例尺寸设置。wh-11/12 - 特殊值:(显式
wh-auto)、SIZE(wh-full)和100%(wh-screen)。FILL - 使用这些类替代单独的和
w-类,可提高XML可读性并减小生成的TSS文件大小。h-
- 数值比例:
:::tip 布局技巧:边缘固定
如果使用外边距()导致或意外拉伸,这是由于Titanium的边缘固定规则(两个相对边缘固定 = 计算尺寸)。请使用类显式强制行为,防止拉伸。
:::
m-LabelButtonwh-autoSIZE- 切勿显式添加类 - 这是默认值,需要时使用
composite/horizontalvertical - 任意值使用括号:、
w-(100px)- 请勿使用方括号bg-(#ff0000) - **在中需要设置
config.cjs**以支持Ti元素样式mode: 'all' - 类使用短横线命名法:,ID使用驼峰命名法:
.my-class#myId
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']
})错误示例:
xml
<View class="flex-row justify-between"> <!-- Flexbox不存在 -->
<View class="p-4"> <!-- View不支持内边距 -->
<View class="composite"> <!-- 切勿显式添加composite -->正确示例:
xml
<View class="horizontal">
<View class="m-4"> <!-- 使用子元素的外边距 -->
<View> <!-- 省略布局类,默认使用composite -->错误示例(动态组件):
javascript
// 使用Ti.UI.create()手动设置样式
const view = Ti.UI.createView({
width: Ti.UI.FILL,
backgroundColor: '#fff',
borderRadius: 8
})正确示例(动态组件):
javascript
// 使用PurgeTSS类和$.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.
:::
:::danger 重要提示:建议前务必验证类
切勿基于其他CSS框架的知识猜测或虚构类!
PurgeTSS与部分CSS框架命名相似,但针对Titanium有不同的类。建议前务必验证类是否存在。
:::
Verification Steps
验证步骤
-
Check if it's a KNOWN anti-pattern
- See PROHIBITED Classes
- Common mistakes: ,
flex-row,justify-betweenon Views (p-* not supported on Views)p-4
-
Check the Class Index
- See Class Index for available patterns
- Constant properties like ,
keyboard-type-*have dedicated classesreturn-key-type-*
-
Search the project when unsurebash
# 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
app.tss - Report any typos or non-existent classes to the user
- Check
-
检查是否为已知反模式
- 参见禁止使用的类
- 常见错误:、
flex-row、View上的justify-between(View不支持p-*类)p-4
-
检查类索引
- 参见类索引获取可用模式
- 常量属性如、
keyboard-type-*有专属类return-key-type-*
-
不确定时搜索项目bash
# 在项目的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 -
修改后
- 检查末尾的“未使用或不支持的类”部分
app.tss - 向用户报告任何拼写错误或不存在的类
- 检查
What HAS Classes vs What DOESN'T
有类与无类的对比
| Has Classes in PurgeTSS | Does NOT Have Classes |
|---|---|
| |
| |
| |
| |
| |
| |
| |
| |
:::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.
:::
| PurgeTSS中有对应类 | 无对应类的内容 |
|---|---|
| |
| |
| |
| |
| |
| |
| |
| View上的 |
:::tip
不确定时,优先使用上述搜索命令验证。花5秒验证比建议不存在的类并导致“未使用类”警告要好得多。
:::
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
$.UI.create()for creating components in Controllers (READ FIRST for dynamic components)Alloy.createStyle()
- 类索引 - 快速模式、禁止使用的类、验证命令(对类有疑问时首先加载)
- 动态组件创建 - 在控制器中使用和
$.UI.create()创建组件(动态组件相关内容首先阅读)Alloy.createStyle()
Setup & Configuration
设置与配置
- Installation & Setup - First run, VS Code, LiveView
- CLI Commands - All commands
purgetss - Migration Guide - Migrating existing apps from manual TSS to PurgeTSS
- 安装与设置 - 首次运行、VS Code、LiveView
- CLI命令 - 所有命令
purgetss - 迁移指南 - 将现有应用从手动TSS迁移到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
- 深度自定义 - config.cjs、颜色、间距、Ti元素
- 自定义规则 - Ti元素、ID、类的样式设置
- Apply指令 - 提取实用类组合
- 可配置属性 - 80+可自定义属性
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
- UI/UX设计模式 - 使用PurgeTSS构建移动UI组件的完整指南(卡片、列表、表单、按钮、导航、模态框、无障碍)
- 网格布局系统 - 12列网格、响应式布局
- 智能映射 - 间距、阴影和网格的底层工作原理
- 任意值 - 使用括号表示法设置自定义值
- 平台修饰符 - ios:, android:, tablet:, handheld:
- 透明度修饰符 - 使用/50语法设置颜色透明度
- Titanium重置样式 - Ti元素的默认样式
Performance
性能
- Performance Tips - Optimizing PurgeTSS apps (bridge crossings, ListView, animations)
- 性能优化技巧 - 优化PurgeTSS应用(桥接调用、ListView、动画)
Components
组件
- TiKit UI Components - Ready-to-use Alerts, Avatars, Buttons, Cards, Tabs built with PurgeTSS
- TiKit UI组件 - 使用PurgeTSS构建的即用型警告框、头像、按钮、卡片、标签页
Fonts & Animations
字体与动画
- Icon Fonts - Font Awesome 7, Material Icons, custom icon libraries
- Animation Component - Declarative API
<Animation>
:::tip TEXT FONTS (Google Fonts, Roboto, etc.)
For text fonts, see CLI Commands → build-fonts.
:::
- 图标字体 - Font Awesome 7、Material Icons、自定义图标库
- 动画组件 - 声明式API
<Animation>
:::tip 文本字体(Google Fonts、Roboto等)
文本字体相关内容请参见CLI命令 → 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
$.UI.create()Alloy.createStyle()
See EXAMPLES.md and Dynamic Component Creation
完整的错误与正确示例包括:
- Titanium布局模式(horizontal、vertical、composite)
- 百分比网格
- 间距使用
- 手动.tss反模式
- 使用和
$.UI.create()创建动态组件Alloy.createStyle()
请参见EXAMPLES.md和动态组件创建
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) | |
对于样式之外的任务,请使用以下互补技能:
| 任务 | 使用技能 |
|---|---|
| 项目架构、服务、控制器 | |
| 复杂UI组件、ListView、手势 | |
| Alloy MVC概念、数据绑定、TSS语法 | |
| 原生功能(相机、定位、推送) | |