@ better-cs-moules/cli (英语)
这个 generate, (中文(简体) ), check 财务报告和审定财务报表 tokens 更好css-模块的命令 : .d.ts 用于 CSS 模块的文件,用于检查未使用的类,绕过设计符的不纯模块和值,以及被写入 DTCG 的符号.
安装
pnpm add -D @better-css-modules/cli @better-css-modules/core
配置文件导入 defineConfig 从 @better-css-modules/core。 。 。 .
图标
better-css-modules generate # write the .d.ts files
better-css-modules generate --watch # and keep them in sync with the stylesheets
better-css-modules check # report problems
better-css-modules check --format github # as GitHub Actions annotations
better-css-modules tokens # print the tokens as DTCG
每个命令都读到 better-css-modules.config.* 在工作目录中; --config <path> 名称另一个文件,相对于工作目录。 配置文件的目录是工程根.
check 每个问题打印一行,然后显示多少行:
src/Card.tsx:6:22 error usage/unanalyzable: a class is accessed dynamically here, so usage of src/badge.module.css cannot be determined
src/card.module.css:2:10 error tokens/color: #fff is a raw value for color; use a --color-* token
src/card.module.css:4:1 error usage/unused-class: .ghost is never used
src/card.module.css:5:10 error tokens/unknown: --color-fg-bsae is not defined in the global CSS; did you mean --color-fg-base?
src/orphan.module.css:1:1 error usage/unused-module: src/orphan.module.css is never imported
[better-css-modules] 5 problem(s)
当没有的时候
[better-css-modules] no problems found (1 modules; tokens: color, spacing, radius)
退出代码
| 代码 | generate | check | tokens |
|---|---|---|---|
| 0 个 | 这些类型是书写的,当 include 匹配无文件 | 没问题 | 文件已经打印 |
| 1个 | 样式表不解析;其 .d.ts 原样左起 | 发现问题 | |
| 2个 | 无法运行: 未知的命令或选项, 或配置错误 | 无法运行: 相同, 未知 --format,或 include 匹配无文件, 无法读取全局 CSS, 或者它不声明 layer | 它无法运行: 同样, 全球 CSS 无法读取, 或者一个符号没有 DTCG 名称 |
配置
设置、规则以及如何禁用这些设置、规则和规则在 README 项目中描述 :
许可证
麻省理工学院