Regalamiunsorriso/faceai/apps/frontend/src/legacyAssets.js

26 lines
842 B
JavaScript
Raw Normal View History

const legacyAssetBaseUrl = (import.meta.env.VITE_LEGACY_ASSET_BASE_URL || '/legacy-static').replace(/\/$/, '');
export function legacyAsset(path) {
return `${legacyAssetBaseUrl}${path.startsWith('/') ? path : `/${path}`}`;
}
export function injectLegacyStylesheets() {
const stylesheets = [
legacyAsset('/vendor/bootstrap/css/bootstrap.min.css'),
legacyAsset('/css/font-awesome.min.css'),
'https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,700,700i',
legacyAsset('/css/custom-style.css')
];
stylesheets.forEach((href) => {
if (document.head.querySelector(`link[data-legacy-href="${href}"]`)) {
return;
}
const link = document.createElement('link');
link.rel = 'stylesheet';
link.href = href;
link.dataset.legacyHref = href;
document.head.appendChild(link);
});
}