@itwin/itwinui-react
Version:
A react component library for iTwinUI
34 lines (33 loc) • 760 B
JavaScript
;
Object.defineProperty(exports, '__esModule', {
value: true,
});
Object.defineProperty(exports, 'importCss', {
enumerable: true,
get: function () {
return importCss;
},
});
const importCss = async (url) => {
try {
return await new Function(
`return import("${url}", { with: { type: "css" } })`,
)();
} catch {
try {
return await new Function(
`return import("${url}", { assert: { type: "css" } })`,
)();
} catch {
return await fetch(url)
.then((res) => res.text())
.then((cssText) => {
let stylesheet = new CSSStyleSheet();
stylesheet.replaceSync(cssText);
return {
default: stylesheet,
};
});
}
}
};