@blackbaud/skyux-design-tokens

中文文档
7.6.0发布于 2026/11/03MITES Module零依赖近 30 天下载 5.2万

Design tokens for SKY UX

原始使用文档
文档目录4 节
  1. Updating snapshot tests
  2. Testing with local preview
  3. Visual tests
  4. Percy snapshots

skyux-design-tokens

npm

This repository contains design tokens for building styles for SKY UX. The tokens are stored in 'src/design-tokens.yml' When this package is released, it will contain the following files:

|-- scss
|    |-- variables.scss (A sass variable file containing the design tokens)
|    |-- mixins.scss (A file containing convenience mixins)
|-- yaml
|    |-- design-tokens.yaml (The original yaml file containing the SKY UX design tokens)
|-- json
|    |-- design-tokens.json (A JSON representation of the design tokens)

To create these result files locally, clone this repository, run npm install and then npm run build.

Updating snapshot tests

If you see a test failure that indicates the test is "obsolete," it means that the outputted tokens have changed and the snapshot test failed. To update the snapshot, run vitest run --update and review the changes to the snapshot file to ensure they are all expected. If you do not have vitest installed, run npm i -g vitest.

Testing with local preview

To view local tokens changes in production SPAs, ensure you have a .env.local file and run the command npm run dev. The local preview will apply to all SPAs at the same domain as the VITE_LAUNCH_URL specified in your .env.local. The preview will refresh when you edit and save a file.

If you do not have an .env.local file, reach out to someone on the team for help setting it up.

To add additional CSS to any SPA you are locally previewing, create a file src/dev/extra-styles.css. This stylesheet will be added to the SPA and can be used to override styles for testing purposes. It is a regular CSS file, so Angular selectors like :ng-deep and :host and SCSS nesting syntax will not work. !important will work, and will be helpful for testing.

Visual tests

src/visual-tests is a framework-free page that renders a demo of every public class and custom property from the built bundles/public-api-styles.json and bundles/public-api-tokens.json, styled by the built CSS. It is used for visual regression snapshots.

Run npm run visual-tests to build the package and serve the page, or npm run build:visual-tests to build it as static files in dist-visual-tests/.

Query params choose what to render:

ParamValuesDefault
pageborders, colors, elevation, spacing, typographyAll pages
themedefault, moderndefault
modelight, darklight
brandbase, blackbaudbase
spacingstandard, compactstandard

mode, brand, and spacing only apply to the modern theme. For example, ?page=colors&theme=modern&mode=dark&brand=blackbaud.

Once the page has rendered, body gets a data-ready attribute, so snapshot tools can wait for body[data-ready].

Percy snapshots

Run npm run test:visual-tests to build the page, serve it, and use Playwright to take a Percy snapshot of every page in each of these themes:

  • default
  • modern in light and dark mode, with the base and blackbaud brands

compact spacing is not snapshotted because no tokens change with it yet.

Without a PERCY_TOKEN environment variable, Percy is skipped and the tests only check that every page renders. Set PERCY_TOKEN to the project token to send the snapshots to Percy.

The Visual tests GitHub workflow runs this on every pull request and on pushes to master and release branches. Pushes create the baselines that pull requests are compared against. Pull requests from forks do not have access to the token, so they run without Percy.

版本与发布记录

@blackbaud/skyux-design-tokens 共发布 157 个版本,首次发布于 2017/06/24;过去 12 个月发布了 61 个版本。

版本发布日期距今
7.6.0latest2026/11/035 天前
7.5.02026/10/308 天前
7.4.02026/10/299 天前
7.3.02026/10/2910 天前
7.2.02026/10/2811 天前
7.1.02026/10/2711 天前

其他发布通道:next → 7.0.0-alpha.12。

关于 @blackbaud/skyux-design-tokens 的常见问题

@blackbaud/skyux-design-tokens 是什么?

Design tokens for SKY UX

如何安装 @blackbaud/skyux-design-tokens?

在项目目录运行 npm install @blackbaud/skyux-design-tokens,或使用 pnpm add / yarn add / bun add。

@blackbaud/skyux-design-tokens 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/blackbaud__skyux-design-tokens 是否存在。

@blackbaud/skyux-design-tokens 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@blackbaud/skyux-design-tokens 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >= 4.2.1。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@blackbaud/skyux-design-tokens 可以商用吗?

@blackbaud/skyux-design-tokens 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@blackbaud/skyux-design-tokens 的下载量有多少?

根据 npm 官方下载统计,@blackbaud/skyux-design-tokens 在 2026/10/09 – 2026/11/07 这 30 天内被下载 51,708 次,日均约 1,724 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@blackbaud/skyux-design-tokens 还在维护吗?

最新版本 7.6.0 发布于 2026/11/03(5 天前);至今共发布 157 个版本,其中过去 12 个月发布了 61 个;首次发布于 2017/06/24。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。