Skip to content

Commit

Permalink
docs: fix v2 pficon getIconUrl override
Browse files Browse the repository at this point in the history
  • Loading branch information
zeroedin committed Jun 25, 2024
1 parent 3e9d785 commit abb6e65
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion docs/main.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
import '@rhds/elements/rh-footer/rh-global-footer.js';
import 'element-internals-polyfill';
import '@patternfly/elements/pf-icon/pf-icon.js';
import { PfIcon } from '@patternfly/elements/pf-icon/pf-icon.js';

// if `/v2/` path load icons from static directory
if (document.location.href.includes('/v2/')) {
// Workaround for bundled pf-icon: make icon imports absolute, instead of relative to the bundle
PfIcon.getIconUrl = (set, icon) => {
const url = new URL(`/v2/components/icon/icons/${set}/${icon}.js`, import.meta.url);
return url;
};
}

0 comments on commit abb6e65

Please sign in to comment.