Skip to content

Commit

Permalink
Update build.
Browse files Browse the repository at this point in the history
  • Loading branch information
croxton committed Dec 3, 2023
1 parent cf04b23 commit 5b690b4
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions dist/components.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,23 @@ class HtmxComponent {
refresh() {
this.unmount(), this.mount();
}
css(urls) {
return Promise.all(urls.map(this._loadCSS));
}
_loadCSS(href) {
return new Promise((resolve) => {
if (HtmxComponent.sheets.includes(href))
return resolve();
HtmxComponent.sheets.push(href);
let link = document.createElement("link");
link.type = "text/css", link.rel = "stylesheet", link.onload = resolve, link.setAttribute("href", href), document.head.appendChild(link);
});
}
}
Object.defineProperty(HtmxComponent, "sheets", {
value: [],
writable: !0
});
(function() {
let config = {
origin: location.origin,
Expand Down

0 comments on commit 5b690b4

Please sign in to comment.