@contentful/forma-36-tokens

中文文档
0.11.2发布于 2022/03/03MITTypeScriptCommonJS零依赖近 30 天下载 6.5万

Forma 36 Tokens

原始使用文档
文档目录5 节
  1. Library usage
  2. Install the package to your project
  3. Import into your project
  4. Development
  5. Creating a build

Forma 36 Tokens

The design tokens for Forma 36, available as JSON, CSS, and SCSS.

These tokens are a key part of our design system and power both forma-36-react-components and forma-36-fcss.

Library usage

Install the package to your project

yarn add @contentful/forma-36-tokens

Or for NPM

npm i @contentful/forma-36-tokens

Import into your project

JS

import F36Tokens from '@contentful/forma-36-tokens';

CSS

@import '@contentful/forma-36-tokens/dist/css/index.css';

SCSS

@import '@contentful/forma-36-tokens/dist/scss/index.scss';

JSON

import tokens from '@contentful/forma-36-tokens/dist/json/transitions/transition-easings';

Development

For local development run yarn from the root of this repo to install all dependencies and run yarn build from the root of this repo to build all packages.

All tokens are kept in the src/tokens directory and organised as so:

.
├── border-radius
│   ├── border-radius.js
├── box-shadows
│   ├── box-shadows.js
│   └── glows.js
├── colors
│   ├── colors-blue.js
│   ├── colors-contrast.js
│   ├── colors-coral.js
│   ├── colors-elements.js
│   ├── colors-green.js
│   ├── colors-ice.js
│   ├── colors-mint.js
│   ├── colors-orange.js
│   ├── colors-peach.js
│   ├── colors-red.js
│   ├── colors-semantic.js
│   ├── colors-text.js
│   └── colors-white.js
├── spacing.js
├── transitions
│   ├── transition-durations.js
│   └── transition-easings.js
├── typography
│   ├── font-base.js
│   ├── font-size.js
│   ├── font-stack.js
│   ├── font-weight.js
│   ├── letter-spacing.js
│   └── line-height.js
└── typography.js

Creating a build

yarn build

Running the build script will populate the dist directory with separately built JSON, CSS, SCSS and JS file with TS typings.

This script populates the dist folder with all tokens as JSON, CSS, SCSS and JS. For CSS and SCSS builds, an index file is included for ease of importing.

版本与发布记录

@contentful/forma-36-tokens 共发布 118 个版本,首次发布于 2018/12/04;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.11.2latest2022/03/034 年前
0.11.12021/08/065 年前
0.11.02021/07/225 年前
0.10.3-next-v3-new-tokens.58next-v3-new-tokens2021/07/165 年前
0.10.3-next-v3-new-tokens.562021/07/165 年前
0.10.22021/05/075 年前

其他发布通道:next-v3 → 0.9.3-next-v3-2852.221,next-v4 → 0.9.3-next-v4-3280.164,next-v3-new-tokens → 0.10.3-next-v3-new-tokens.58。

关于 @contentful/forma-36-tokens 的常见问题

@contentful/forma-36-tokens 是什么?

Forma 36 Tokens

如何安装 @contentful/forma-36-tokens?

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

@contentful/forma-36-tokens 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@contentful/forma-36-tokens 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@contentful/forma-36-tokens 可以商用吗?

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

@contentful/forma-36-tokens 的下载量有多少?

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

@contentful/forma-36-tokens 还在维护吗?

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