Skip to content

Commit

Permalink
Add FontAwesome support
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonMayerhofer committed Oct 17, 2020
1 parent 9996817 commit 53bac9e
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 0 deletions.
21 changes: 21 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
},
"dependencies": {
"@babel/polyfill": "7.12.1",
"@fortawesome/fontawesome-svg-core": "1.2.32",
"@fortawesome/free-solid-svg-icons": "5.15.1",
"foundation-sites": "6.6.3",
"jquery": "3.5.1",
"motion-ui": "2.0.3",
Expand Down
4 changes: 4 additions & 0 deletions src/assets/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,9 @@ if (
import './lib/foundation';
import './helper/exit-intent-reveal';

// import FA last, to kick off the process of finding <i> tags and
// replacing with <svg> tags, after importing all components.
import './lib/FontAwesome';

// because jQuery is included with webpack.ProvidePlugin we can
// just use jQuery and $ variables without importing it again.
52 changes: 52 additions & 0 deletions src/assets/js/lib/FontAwesome.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/**
* Integrate FontAwesome Icons
*
* Available Packages:
* @fortawesome/free-solid-svg-icons
* @fortawesome/free-regular-svg-icons
* @fortawesome/free-brands-svg-icons
* @fortawesome/pro-solid-svg-icons
* @fortawesome/pro-regular-svg-icons
* @fortawesome/pro-light-svg-icons
* @fortawesome/pro-duotone-svg-icons
*
* You need to install needed packages first:
* npm i -E @fortawesome/free-regular-svg-icons
*
* Access to the Pro packages requires you to configure the @fortawesome scope
* to use teir Pro NPM registry.
* @see https://fontawesome.com/how-to-use/on-the-web/setup/using-package-managers#installing-pro
*/

import { library, dom } from '@fortawesome/fontawesome-svg-core';

/* SOLID */
import { faArrowCircleRight } from '@fortawesome/free-solid-svg-icons/faArrowCircleRight';

/* REGULAR */

/* LIGHT */

/* DUOTONE */

/* BRANDS */

/* register used fontawesome icons */
library.add(
/* SOLID */
faArrowCircleRight,

/* REGULAR */

/* LIGHT */

/* DUOTONE */

/* BRANDS */
);

// Kicks off the process of finding <i> tags and replacing with <svg>
dom.i2svg();

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

0 comments on commit 53bac9e

Please sign in to comment.