@@ -109,7 +109,7 @@ If it is necessary to modify the [antd5 theme](https://ant.design/docs/react/cus
109109// default.scss
110110:root {
111111 --color-primary : #00b96b ; // -> colorPrimary: #00b96b
112- --border-radius : 4px ; // -> borderRadius: 4px
112+ --border-radius : 4px ; // -> borderRadius: 4
113113}
114114```
115115
@@ -121,11 +121,11 @@ If it is necessary to modify the [antd5 theme](https://ant.design/docs/react/cus
121121 "tokens" : {
122122 "dark" : {
123123 "colorPrimary" : " #000" ,
124- "borderRadius" : " 4px " ,
124+ "borderRadius" : " 4 " ,
125125 },
126126 "default" : {
127127 "colorPrimary" : " #00b96b" ,
128- "borderRadius" : " 4px "
128+ "borderRadius" : " 4 "
129129 }
130130 },
131131 "vars" : {
@@ -150,51 +150,6 @@ css 变量在切换主题时自动注入到 `head` 下,保证 [antd@5.x](https
150150 </style >
151151```
152152
153- 警告⚠️: 主题文夹下文件中仅支持 css 变量
154-
155- <!-- 如果使用`less`, 请安装 [less-vars-to-js](https://www.npmjs.com/package/less-vars-to-js) 按照下面 👇 代码自行调试。
156-
157- If using `less`, please install [less-vars-to-js](https://www.npmjs.com/package/less-vars-to-js) According to the following 👇 Code self debugging.
158-
159- ````ts
160- import lessToJs from 'less-vars-to-js';
161- import { lowerCamel } from '@skax/camel';
162- import fs from 'fs';
163-
164- /**
165- * less 变量转成 json 格式 (更改 antd 主题样式更新需要重启)
166- * Convert the less variable to JSON format
167- *
168- * @example
169- *
170- * ```less
171- * $color-primary: #00b96b;
172- * $border-radius: 2px;
173- * ```
174- *
175- * ```js
176- * lessVar2JSON() // -> {"colorPrimary": "#00b96b", "borderRadius": "2px"}
177- * ```
178- *
179- * @returns {Object}
180- */
181- function lessVar2JSON() {
182- // Read the less file in as string
183- const paletteLess = fs.readFileSync('./src/styles/antd-theme.less', 'utf-8');
184- // Pass in file contents
185- const palette = lessToJs(paletteLess, {
186- resolveVariables: true,
187- stripPrefix: true,
188- });
189-
190- return Object.keys(palette).reduce((pre, cur) => {
191- pre[lowerCamel(cur, '-')] = palette[cur];
192- return pre;
193- }, {});
194- }
195- export default lessVar2JSON;
196- ```` -->
197-
198153## Api
199154
200155[ gin_serve api] ( https://github.com/freeshineit/gin_serve )
0 commit comments