@aleph-alpha/config-tokens

中文文档
0.2.0发布于 2026/06/18Apache-2.0ES Module近 30 天下载 1.4万

@aleph-alpha/config-tokens

原始使用文档
文档目录7 节
  1. Config Tokens
  2. Installation
  3. Usage
  4. Token Pipeline
  5. Development
  6. Config Tokens helps in UI Customization
  7. References

Config Tokens

@aleph-alpha/config-tokens

Design tokens for Aleph Alpha frontends, derived from the Figma library via Tokens Studio and Style Dictionary. Exposes the processed tokens as JSON so other packages can consume them.

The UnoCSS presets that turn these tokens into utility classes and CSS variables live in @aleph-alpha/config-unocss. Embedded web fonts (Raleway, Roboto, Montserrat, Inter) live in @aleph-alpha/config-fonts.

Installation

pnpm add @aleph-alpha/config-tokens

Usage

Import token sets directly as JSON:

import lightModeSet from '@aleph-alpha/config-tokens/sd-output/light-mode.json';
import darkModeSet from '@aleph-alpha/config-tokens/sd-output/dark-mode.json';
import spacingsSet from '@aleph-alpha/config-tokens/sd-output/spacings.json';
import boxShadowsSet from '@aleph-alpha/config-tokens/sd-output/box-shadows.json';
import typographySet from '@aleph-alpha/config-tokens/sd-output/typography.json';

For UnoCSS consumers, use @aleph-alpha/config-unocss instead — it already wires these JSON files into a preset stack with CSS custom properties, theme mapping, and web fonts.

Token Pipeline

The package's purpose is to take Figma Tokens via Tokens Studio and transform them into JSON files that downstream packages (UnoCSS preset, MUI palette, …) can consume.

The build steps are:

  1. Designer pushes token changes from Figma to tokens.json and opens a MR.
  2. When the MR is merged, the pipeline runs and triggers the build process.
  3. Tokens from tokens.json are transformed, split into different categories, and stored in the transformed-tokens directory with token-transformer so Style Dictionary can read them. Categories are light-mode, dark-mode, and global.
  4. The transformed tokens are processed with Style Dictionary to generate token sets in sd-output/.
  5. Consumers (e.g. @aleph-alpha/config-unocss) read the sd-output/ JSON via subpath imports.
graph TD
    A[Designer pushes token changes from Figma to tokens.json] --> B[Open MR]
    B --> C{MR merged?}
    C -->|Yes| D[Pipeline runs]
    D --> E[Trigger build process]
    E --> F[Transform and split tokens with token-transformer]
    F --> G[Store transformed tokens in transformed-tokens directory]
    G --> H[Process tokens with style-dictionary]
    H --> I[Store processed tokens in sd-output directory]
    C -->|No| B
    subgraph Token Categories
        F --> F1[light-mode]
        F --> F2[dark-mode]
        F --> F3[global]
    end

Development

pnpm install
pnpm build

Config Tokens helps in UI Customization

Read more here

References

版本与发布记录

@aleph-alpha/config-tokens 共发布 1 个版本,首次发布于 2026/06/18;过去 12 个月发布了 1 个版本。

版本发布日期距今
0.2.0latest2026/06/184 个月前

关于 @aleph-alpha/config-tokens 的常见问题

@aleph-alpha/config-tokens 是什么?

@aleph-alpha/config-tokens

如何安装 @aleph-alpha/config-tokens?

在项目目录运行 npm install @aleph-alpha/config-tokens,或使用 pnpm add / yarn add / bun add。

@aleph-alpha/config-tokens 支持 TypeScript 吗?

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

@aleph-alpha/config-tokens 支持 ESM 还是 CommonJS?

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

@aleph-alpha/config-tokens 可以商用吗?

@aleph-alpha/config-tokens 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@aleph-alpha/config-tokens 的下载量有多少?

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

@aleph-alpha/config-tokens 还在维护吗?

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