diff options
Diffstat (limited to 'css.js')
| -rw-r--r-- | css.js | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -0,0 +1,12 @@ + +async function load_sheet(url) { + const response = await fetch(url); + const content = await response.text(); + const sheet = new CSSStyleSheet(); + await sheet.replace(content); + return sheet; +} + +export async function css(base, ...urls) { + return await Promise.all(urls.map(url => load_sheet(new URL(url, base)))) +} |