Skip to content

Commit

Permalink
Fix font awesome plugin conflicts in wp-admin
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonMayerhofer committed May 11, 2021
1 parent eee6b45 commit 07e77f3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/assets/js/blocks/accordion.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { library, dom } from '@fortawesome/fontawesome-svg-core';

const blockName = 'accordion';

/**
Expand All @@ -15,6 +17,9 @@ const blockName = 'accordion';
function initializeBlock($block) {
// initialize element with foundation plugin.
$block.find('[data-accordion]').foundation();

// Font Awesome Icons -> SVG
dom.i2svg({ node: $block[0] });
}

// Initialize each block on page load (front end).
Expand Down
6 changes: 4 additions & 2 deletions src/assets/js/lib/FontAwesome.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ library.add(
);

// Kicks off the process of finding <i> tags and replacing with <svg>
dom.i2svg();
$('.site-header, .main-container, .footer').each((i, el) => {
dom.i2svg({ node: el });
});

// use dom.watch if you plan to dynamically add <i> icon tag.
dom.watch();
// dom.watch();

0 comments on commit 07e77f3

Please sign in to comment.