Skip to content

Commit 05feb5b

Browse files
committed
docs: 更新readme
1 parent e4cd2fc commit 05feb5b

File tree

1 file changed

+5
-28
lines changed

1 file changed

+5
-28
lines changed

README.md

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,6 @@ const { code } = parse(jsxCode, [cssCode1, cssCode2, ...], {
1717
// code: jsx代码 string
1818
```
1919

20-
### css 变量打包
21-
22-
如果需要支持 css 变量的打包,需要将出参`cssVariables`进行二次编译,如下例子所示:
23-
24-
```typescript
25-
import { parse, combineCssVariables } from '@tarojs/parse-css-to-stylesheet'
26-
27-
// Harmony
28-
const { code: CodeA, cssVariables: cssVariablesA } = parse(jsxCodeA, [cssRootVarCode, cssCodeA, ...], {
29-
platformString: 'Harmony'
30-
})
31-
const { code: codeB, cssVariables: cssVariablesB } = parse(jsxCodeB, [cssRootVarCode, cssCodeB, ...], {
32-
platformString: 'Harmony'
33-
})
34-
// 获取合并后的css变量代码
35-
const css_variable_code: String = cssVariables([cssVariablesA, cssVariablesB])
36-
```
37-
3820
## 参数说明
3921

4022
```typescript
@@ -44,7 +26,6 @@ export interface ParseOptions {
4426
}
4527
export interface ParseResult {
4628
code: string; // 输出的jsxcode
47-
cssVariables?: string; // css变量字符串片段
4829
}
4930

5031
// 样式解析
@@ -53,9 +34,6 @@ export function parse(
5334
styles: Array<string>,
5435
options: ParseOptions
5536
): ParseResult;
56-
57-
// 合并css变量字符串片段,输出运行的代码字符
58-
export function combineCssVariables(variables: Array<string>): string | null;
5937
```
6038

6139
#### ParseOptions
@@ -67,18 +45,17 @@ export function combineCssVariables(variables: Array<string>): string | null;
6745

6846
#### ParseResult
6947

70-
| 配置参数 | 类型 | 说明 |
71-
| ------------ | ------- | ------------------------- |
72-
| code | String | 经过样式解析后的 JSX 代码 |
73-
| cssVariables | Boolean | CSS 变量字符串片段 |
48+
| 配置参数 | 类型 | 说明 |
49+
| -------- | ------ | ------------------------- |
50+
| code | String | 经过样式解析后的 JSX 代码 |
7451

75-
<!-- 在 Harmony 中,编译结果会依赖`@tarojs/plugin-platform-harmony-ets`中提供的几个包方法:
52+
在 Harmony 中,编译结果会依赖`@tarojs/plugin-platform-harmony-ets`中提供的几个包方法:
7653

7754
1. `convertNumber2VP` 用于运行时进行单位转换
7855
2. `calcStaticStyle` 用于合成类,匹配类名
7956
3. `__combine_nesting_style__` 嵌套样式的合成
8057

81-
具体位于 [Taro 主仓](https://github.com/NervJS/taro) 路径:_/taro/packages/taro-platform-harmony/src/runtime-ets_ 中 -->
58+
具体位于 [Taro 主仓](https://github.com/NervJS/taro) 路径:_/taro/packages/taro-platform-harmony/src/runtime-ets_
8259

8360
## 样式支持情况
8461

0 commit comments

Comments
 (0)