Style Dictionary Utils 使用教程

Style Dictionary Utils 使用教程

style-dictionary-utilsUtilities to use in your style dictionary config项目地址:https://gitcode.com/gh_mirrors/st/style-dictionary-utils

1. 项目的目录结构及介绍

style-dictionary-utils/
├── src/
│   ├── filters/
│   ├── formats/
│   ├── transforms/
│   └── utils/
├── tsconfig.json
├── package.json
└── README.md
  • src/: 包含项目的源代码,分为多个子目录:
    • filters/: 包含用于过滤设计令牌的函数。
    • formats/: 包含用于格式化输出文件的函数。
    • transforms/: 包含用于转换设计令牌的函数。
    • utils/: 包含一些通用的工具函数。
  • tsconfig.json: TypeScript 配置文件。
  • package.json: 项目的依赖和脚本配置文件。
  • README.md: 项目说明文档。

2. 项目的启动文件介绍

项目的启动文件通常是 package.json 中定义的脚本。例如:

{
  "scripts": {
    "build": "tsc",
    "start": "node dist/index.js"
  }
}
  • build: 使用 tsc 编译 TypeScript 代码。
  • start: 运行编译后的 JavaScript 文件。

3. 项目的配置文件介绍

tsconfig.json

{
  "compilerOptions": {
    "target": "ES6",
    "module": "commonjs",
    "outDir": "./dist",
    "strict": true,
    "esModuleInterop": true
  },
  "include": ["src"]
}
  • target: 指定编译目标为 ES6。
  • module: 使用 CommonJS 模块系统。
  • outDir: 编译输出目录为 dist
  • strict: 启用所有严格类型检查选项。
  • esModuleInterop: 允许使用 ES 模块语法导入 CommonJS 模块。
  • include: 包含 src 目录下的所有文件。

package.json

{
  "name": "style-dictionary-utils",
  "version": "1.0.0",
  "description": "A package of transforms, formats, filters, etc to use in your style dictionary config to transform your design tokens",
  "main": "dist/index.js",
  "scripts": {
    "build": "tsc",
    "start": "node dist/index.js"
  },
  "dependencies": {
    "style-dictionary": "^3.0.0"
  },
  "devDependencies": {
    "typescript": "^4.0.0"
  }
}
  • name: 项目名称。
  • version: 项目版本。
  • description: 项目描述。
  • main: 入口文件路径。
  • scripts: 定义了一些常用的脚本命令。
  • dependencies: 项目运行时的依赖。
  • devDependencies: 开发时的依赖。

以上是 style-dictionary-utils 项目的基本使用教程,涵盖了项目的目录结构、启动文件和配置文件的介绍。希望对您有所帮助!

style-dictionary-utilsUtilities to use in your style dictionary config项目地址:https://gitcode.com/gh_mirrors/st/style-dictionary-utils

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

平荔允Imogene

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值