aboutsummaryrefslogtreecommitdiff
path: root/css.js
diff options
context:
space:
mode:
Diffstat (limited to 'css.js')
-rw-r--r--css.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/css.js b/css.js
new file mode 100644
index 0000000..9dbf4b0
--- /dev/null
+++ b/css.js
@@ -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))))
+}