@@ -17,24 +17,6 @@ const { code } = parse(jsxCode, [cssCode1, cssCode2, ...], {
17
17
// code: jsx代码 string
18
18
```
19
19
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
-
38
20
## 参数说明
39
21
40
22
``` typescript
@@ -44,7 +26,6 @@ export interface ParseOptions {
44
26
}
45
27
export interface ParseResult {
46
28
code: string ; // 输出的jsxcode
47
- cssVariables? : string ; // css变量字符串片段
48
29
}
49
30
50
31
// 样式解析
@@ -53,9 +34,6 @@ export function parse(
53
34
styles : Array <string >,
54
35
options : ParseOptions
55
36
): ParseResult ;
56
-
57
- // 合并css变量字符串片段,输出运行的代码字符
58
- export function combineCssVariables(variables : Array <string >): string | null ;
59
37
```
60
38
61
39
#### ParseOptions
@@ -67,18 +45,17 @@ export function combineCssVariables(variables: Array<string>): string | null;
67
45
68
46
#### ParseResult
69
47
70
- | 配置参数 | 类型 | 说明 |
71
- | ------------ | ------- | ------------------------- |
72
- | code | String | 经过样式解析后的 JSX 代码 |
73
- | cssVariables | Boolean | CSS 变量字符串片段 |
48
+ | 配置参数 | 类型 | 说明 |
49
+ | -------- | ------ | ------------------------- |
50
+ | code | String | 经过样式解析后的 JSX 代码 |
74
51
75
- <!-- 在 Harmony 中,编译结果会依赖`@tarojs/plugin-platform-harmony-ets`中提供的几个包方法:
52
+ 在 Harmony 中,编译结果会依赖` @tarojs/plugin-platform-harmony-ets ` 中提供的几个包方法:
76
53
77
54
1 . ` convertNumber2VP ` 用于运行时进行单位转换
78
55
2 . ` calcStaticStyle ` 用于合成类,匹配类名
79
56
3 . ` __combine_nesting_style__ ` 嵌套样式的合成
80
57
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_ 中
82
59
83
60
## 样式支持情况
84
61
0 commit comments