@astrouxds/tokens

中文文档
1.14.0发布于 2025/02/24ESM + CJS零依赖近 30 天下载 5172

Astro UXDS Design Tokens

原始使用文档
文档目录11 节
  1. Documentation
  2. Installation
  3. Structure
  4. CSS Custom Properties
  5. Light Theme Class
  6. Typography Utility Classes
  7. SASS
  8. SASS Maps
  9. Pipeline
  10. Contributing
  11. Building locally

Astro UXDS Design Tokens

This package includes all of AstroUXDS's design tokens in various different formats for you to consume in your applications.

Documentation

Astro Design Tokens

Installation

npm i @astrouxds/tokens

Structure

Each export target has the following files:

  • base.reference.*
    • All of the possible variables.
    • Useful in instances where there aren't any system options.
  • base.system.*
    • A limited set of variables with semantic meaning
    • Useful for creating custom pieces of UI.
  • base.component.*
    • Component-specific variables
    • Useful for recreating existing Astro components.

CSS Custom Properties

@import "node_modules/@astrouxds/tokens/dist/css/index.css";

or

@import "node_modules/@astrouxds/tokens/dist/css/base.reference.css";
@import "node_modules/@astrouxds/tokens/dist/css/base.system.css";
@import "node_modules/@astrouxds/tokens/dist/css/base.component.css";

Light Theme Class

@import "node_modules/@astrouxds/tokens/dist/css/theme.light.css";

A light-theme class that includes Astro's light theme.

Typography Utility Classes

@import "node_modules/@astrouxds/tokens/dist/css/classes/typography.css";

A few utility classes for applying Astro typography.

SASS

@import "node_modules/@astrouxds/tokens/dist/scss/base.reference.scss";
@import "node_modules/@astrouxds/tokens/dist/scss/base.system.scss";
@import "node_modules/@astrouxds/tokens/dist/scss/base.component.scss";

SASS Maps

@import "node_modules/@astrouxds/tokens/dist/scss-map-flat/base.reference.scss";
@import "node_modules/@astrouxds/tokens/dist/scss-map-flat/base.system.scss";
@import "node_modules/@astrouxds/tokens/dist/scss-map-flat/base.component.scss";

Pipeline

graph TD
    A[Figma] --> B(data/tokens.json)
    B -->|Token Transformer| D["/tokens/*.json"]
    D -->|Style Dictionary| E["/dist"]
    E -->F[CSS]
    E -->G[SASS]
    E -->H[iOS]
    E -->I[JSON]

Contributing

Building locally

yarn make

版本与发布记录

@astrouxds/tokens 共发布 23 个版本,首次发布于 2022/09/26;过去 12 个月发布了 0 个版本。

版本发布日期距今
1.14.0latest2025/02/241.7 年前
1.13.02025/01/101.8 年前
1.12.02023/10/033 年前
1.11.12023/10/033 年前
2.0.0-beta.2nova2023/09/293 年前
2.0.0-beta.12023/09/293 年前

其他发布通道:next → 1.10.0-next.0,nova → 2.0.0-beta.2。

关于 @astrouxds/tokens 的常见问题

@astrouxds/tokens 是什么?

Astro UXDS Design Tokens

如何安装 @astrouxds/tokens?

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

@astrouxds/tokens 支持 TypeScript 吗?

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

@astrouxds/tokens 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@astrouxds/tokens 可以商用吗?

@astrouxds/tokens 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@astrouxds/tokens 的下载量有多少?

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

@astrouxds/tokens 还在维护吗?

最新版本 1.14.0 发布于 2025/02/24(1.7 年前);至今共发布 23 个版本,其中过去 12 个月发布了 0 个;首次发布于 2022/09/26。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。