blob: 782bd7bb9331c735c26299855ed68beafc1962b2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
async function load_text(content) {
const sheet = new CSSStyleSheet();
await sheet.replace(content);
return sheet;
}
async function load_file(url) {
const response = await fetch(url);
const content = await response.text();
return await load_text(content);
}
export async function sheet(...contents) {
return await Promise.all(contents.map(text => load_text(text)));
}
export async function file(base, ...urls) {
return await Promise.all(urls.map(url => load_file(new URL(url, base))))
}
|