Skip to content

Commit

Permalink
Merge pull request #2793 from patternfly/docs/v2-icons-path
Browse files Browse the repository at this point in the history
docs: fix v2 pficon getIconUrl override
  • Loading branch information
zeroedin authored Jun 25, 2024
2 parents 3e9d785 + abb6e65 commit 23b0685
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 23b0685

Please sign in to comment.