Skip to content
This repository was archived by the owner on Feb 18, 2023. It is now read-only.

Commit b1cb709

Browse files
committed
fix: fix an error while compiling
1 parent a176bc7 commit b1cb709

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

index.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@ module.exports = function (content, map, meta) {
22
return content
33
.replace(/(?<pre>[^;\s\n}])(?<aft>[\s\n]*})/g, "$<pre>;$<aft>")
44
.replace(/{.+?}/sg, container => {
5-
const props = container.substr(1).slice(0, -1);
6-
return "{" + props.replace(/[^;:{}]+?:[^;:{}]+?;/sg, prop => {
7-
if(prop.indexOf("vh") < 0){
8-
return prop;
9-
}else{
10-
return prop + prop.replace(/-?[\d\.]+vh/g, part => {
11-
return "calc(var(--vh,1vh)*" + part.match(/(-?[\d\.]+)/)[1] + ")";
12-
})
13-
}
14-
}) + "}";
15-
});
5+
const props = container.substr(1).slice(0, -1);
6+
return "{" + props.replace(/[^;:{}]+?:[^;:{}]+?;/sg, prop => {
7+
if(prop.indexOf("vh") < 0){
8+
return prop;
9+
}else{
10+
return prop + prop.replace(/-?[\d\.]+vh/g, part => {
11+
return "calc(var(--vh,1vh)*" + part.match(/(-?[\d\.]+)/)[1] + ")";
12+
})
13+
}
14+
}) + "}";
15+
})
16+
.replace(/;}/g, "}");
1617
}

0 commit comments

Comments
 (0)