Skip to content

Commit cbaee21

Browse files
committed
fix: css var polyfill
1 parent 543cbbc commit cbaee21

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.0.3
2+
### Bug fixes
3+
- fix: css var polyfill
4+
15
## 2.0.2
26

37
### Bug fixes

src/polyfill.js

+10-7
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,17 @@ export function cssVars () {
1414
if (block.nodeName === 'STYLE') {
1515
replaceVar(block)
1616
} else if (block.nodeName === 'LINK') {
17-
load(block.getAttribute('href'))
18-
.then(res => {
19-
const style = document.createElement('style')
17+
const href = block.getAttribute('href')
2018

21-
style.innerHTML = res
22-
document.head.appendChild(style)
23-
replaceVar(style)
24-
})
19+
if (/\.css$/.test(href)) return
20+
21+
load(href).then(res => {
22+
const style = document.createElement('style')
23+
24+
style.innerHTML = res
25+
document.head.appendChild(style)
26+
replaceVar(style)
27+
})
2528
}
2629
})
2730
}

0 commit comments

Comments
 (0)