问题很简单:
我有一个 javascript 文件
const StyleDictionary = require('style-dictionary').extend('color-config.json');
和一个 json 配置文件
{
"source": ["tokens/color.json"],
"platforms": {
"css": {
"transforms": ["color/css"],
由于我使用的是特定架构,因此我需要在所有令牌配置 json 的源前面加上一个预路径,所以目前的情况是在我的构建过程中源代码 tokens/color.json
不起作用,而是我需要使用例如一些东西像这样/extra/architecture/private/tokens/color.json
。但我不想直接在 json 中附加这个预路径,我希望能够通过一个配置参数通过 javascript 添加它。
目前我找不到一个好的方法,唯一的好方法是直接编辑配置 json 文件。
有更好的想法吗?