Skip to content

Commit

Permalink
fix: css var polyfill
Browse files Browse the repository at this point in the history
  • Loading branch information
QingWei-Li committed Feb 7, 2017
1 parent 543cbbc commit cbaee21
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.0.3
### Bug fixes
- fix: css var polyfill

## 2.0.2

### Bug fixes
Expand Down
17 changes: 10 additions & 7 deletions src/polyfill.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,17 @@ export function cssVars () {
if (block.nodeName === 'STYLE') {
replaceVar(block)
} else if (block.nodeName === 'LINK') {
load(block.getAttribute('href'))
.then(res => {
const style = document.createElement('style')
const href = block.getAttribute('href')

style.innerHTML = res
document.head.appendChild(style)
replaceVar(style)
})
if (/\.css$/.test(href)) return

load(href).then(res => {
const style = document.createElement('style')

style.innerHTML = res
document.head.appendChild(style)
replaceVar(style)
})
}
})
}

0 comments on commit cbaee21

Please sign in to comment.