optimize-page-styles

Rewrite Uni-app subPages styles to use semantic Wot UI variables and BEM naming.

284|31|Updated Jan 15, 2026
One-click install
npx skills add https://github.com/wot-ui/wot-ui --skill optimize-page-styles
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: optimize-page-styles
Source: https://github.com/wot-ui/wot-ui/tree/main/.agents/skills/optimize-page-styles
Command: npx skills add https://github.com/wot-ui/wot-ui --skill optimize-page-styles

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

本技能旨在通过将 subPages 演示页面中的硬编码颜色、字号、间距和圆角替换为 Wot UI 设计系统的语义变量,从而实现统一的视觉风格和对暗色主题的自适应。通过不引入额外的 variable.scss,直接使用已全局注入的 Sass 变量或 CSS 自定义属性,消除手写的样式覆盖。

Core Features & Use Cases

  • 语义变量替换:将颜色、排版和间距等硬编码值替换为 $text-main$spacing-main$radius-large 等变量,或对应的 CSS 自定义属性。
  • BEM 命名规范:将类名统一改为 Block__Element / Block--Modifier 形式,提升可维护性和可读性。
  • 暗色主题自动适配:移除手动的暗色主题覆盖块,由语义变量在主题切换时自动映射。
  • 可选集成:支持直接使用全局注入的 variable.scss 变量,或使用 CSS 自定义属性,无需额外引入。

Quick Start

以目标 subPages 为出发点,将样式中的硬编码值替换为语义变量并将类名改为符合 BEM 的命名,以实现自动主题适配和风格统一。

Frequently Asked Questions about optimize-page-styles

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I replace hard-coded colors and spacing with semantic variables in uni-app subPages?

To replace hard-coded styles in uni-app subPages, rewrite colors, typography, spacing, and radii into semantic Wot UI variables like `$text-main` or CSS custom properties. This enforces visual consistency and enables automatic light and dark theme adaptation without manual overrides.

What is the best way to standardize subPages styles for automatic dark theme adaptation?

The best way to standardize subPages styles for dark theme adaptation is using semantic Wot UI variables. By replacing manual dark mode override blocks with variables like `$spacing-main`, styles automatically map to the correct theme values during theme switching.

Do I need to manually import variable.scss to use Wot UI semantic variables in my subPages?

You do not need to manually import variable.scss to use Wot UI semantic variables in subPages. The variables are globally injected, allowing you to directly use Sass variables or CSS custom properties with safe fallbacks without extra imports.

How does applying BEM naming conventions improve uni-app subPages styling?

Applying BEM naming conventions improves uni-app subPages styling by standardizing class names into Block__Element and Block--Modifier formats. This structural naming enhances CSS readability and maintainability while integrating with semantic variable replacements.

Can I use CSS custom properties instead of Sass variables for uni-app subPages styling?

You can use CSS custom properties instead of Sass variables for uni-app subPages styling. The styling approach supports both globally injected Sass variables and CSS custom properties, providing flexible integration with safe fallbacks.

Why should I remove manual dark mode style overrides from my uni-app subPages?

You should remove manual dark mode style overrides from uni-app subPages because semantic variables automatically handle theme switching. Replacing hard-coded values with variables like `$radius-large` eliminates redundant override blocks and ensures consistent theme adaptation.