About weapp-tailwindcss-runtime
weapp-tailwindcss-runtime is a skill for using the runtime wrappers provided by weapp-tailwindcss in mini-program projects. It guides API selection for class merging, variants, and escaping, with attention to matching runtime behavior to build-time candidates.
Key features
- 01Chooses handling based on class source
- 02Guides selection of merge, cva, and variants
- 03Avoids constructing incomplete dynamic classes
- 04Handles mini-program class escaping and passthrough
- 05Requires conflict and production-build checks
Use cases
- 01Implementing caller overrides for component classes
- 02Configuring variants for single- or multi-slot components
- 03Investigating dynamic classes with missing styles
- 04Checking escaping, conflicts, and cache behavior
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ sonofmagic/ skills --skill weapp-tailwindcss-runtimeAfter installing, type/weapp-tailwindcss-runtimein Claude Code to confirm it loaded.
Bundled filesagents/openai.yamlreferences/runtime-guide.md
Details
From the project READMEweapp-tailwindcss runtime
使用项目提供的运行时封装保持 class 合并、转义和构建期精确候选一致。
工作流
- 识别 class 来源:静态模板、完整字面量条件、组件外部覆盖、第三方透传或真正的运行时输入。
- 读取 references/runtime-guide.md,按任务选择最小包和 API。
- 读取各包当前 manifest 与 exports,避免把
merge/slim、merge/lite、UI CSS 或插件入口当成主入口。 - 优先使用完整 class 字面量或枚举;不要拼接
bg-${color}-500这类半截 token。 - 普通组件覆盖使用
@weapp-tailwindcss/merge;单槽 variants 使用@weapp-tailwindcss/cva;多槽 recipes 使用@weapp-tailwindcss/variants。 - 自定义封装名时检查构建期可识别标识符;需要原样透传时使用
weappTwIgnore,不要扩大全局忽略。 - 自定义 runtime factory、escape/unescape 或 rpx transformer 时保持纯函数边界,并验证缓存淘汰前后的等价输出。
关键约束
- 运行时包已经封装小程序 escape/unescape;不要先手动 escape 再交给 merge/cva/variants。
clsx只负责组合,不解决 Tailwind 冲突;需要“调用方最后覆盖”时使用 merge。- 只有会改变冲突分类的自定义 Tailwind token 才同步 merge 配置,并补冲突用例。
weappTwIgnore是精确局部保护,不是让未扫描动态 class 自动生成 CSS 的工具。- 构建期仍遵循
classNameSet精确命中,运行时封装不能补生成缺失的候选。
输出要求
输出包选择理由、可复制实现、构建期配套配置、类型约束,以及冲突、转义和生产压缩验证用例。
Comments
Markdown supported