-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
36 lines (36 loc) · 736 Bytes
/
Copy pathtest.js
File metadata and controls
36 lines (36 loc) · 736 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
function testObject2CssText() {
const cssObj = {
width: 200,
lineHeight: 2,
fontSize: 10,
borderRadius: 5,
background: "pink",
"&:hover": {
background: "red",
textAlign: "center",
".test-children": {
color: "orange",
paddingLeft: 20,
},
},
};
console.log(CssObjectTransfer.object2CssText(cssObj));
}
function testCssText2Object() {
const str = `
width:200px;
line-height:2;
font-size:10px;
border-radius:5px;
background:pink;
&:hover{
background:red;
text-align: center;
.test-children{
color:orange;
padding-left: 20px;
}
}
`;
console.log(CssObjectTransfer.cssText2Object(str, true));
}