Skip to content

Instantly share code, notes, and snippets.

@stevensacks
Last active November 23, 2019 01:47
Show Gist options
  • Save stevensacks/0a88e2aaedbb423021189f9e9ac51d91 to your computer and use it in GitHub Desktop.
Save stevensacks/0a88e2aaedbb423021189f9e9ac51d91 to your computer and use it in GitHub Desktop.
FontAwesomeIcon without using 'as'

FontAwesomeIcon without using as

To avoid dealing with duplicate names from different icon styles (solid, regular, etc.), just use apply!

import {
faCircle,
faCoffee,
faExclamationTriangle,
} from '@fortawesome/free-regular-svg-icons';
export default [
faCircle,
faCoffee,
faExclamationTriangle,
];
import {
faCircle,
faCoffee,
faExclamationTriangle,
} from '@fortawesome/free-solid-svg-icons';
export default [
faCircle,
faCoffee,
faExclamationTriangle,
];
import far from './far';
import fas from './fas';
import {library} from '@fortawesome/fontawesome-svg-core';
library.add.apply(library, fas.concat(far));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment