## FontAwesome.js - ES6, CommonJS, and AMD module
> "I came here to chew bubblegum and install Font Awesome 5 - and I'm all out of bubblegum"
### Installation
```
$ npm i --save @fortawesome/fontawesome
```
Or
```
$ yarn add @fortawesome/fontawesome
```
Also grab the free solid style or brands:
```
$ yarn add @fortawesome/fontawesome-free-solid
$ yarn add @fortawesome/fontawesome-free-brands
```
## Let's get started
Once you have the packages installed (make sure you get `fontawesome` and at
least one of the styles) you can require or import the library. We're going to give examples in ES6 syntax using import.
```javascript
import fontawesome from '@fortawesome/fontawesome'
import { faUser } from '@fortawesome/fontawesome-free-solid'
fontawesome.icon(faUser)
```
See the [API reference](#api-reference) for more information on what API is available.
## Icon naming
From the beginning Font Awesome has used hyphenated names like `fa-address-book`, `fa-facebook`, or `fa-circle-o`.
JavaScript does not typically use this kind of naming scheme; it uses camelCase. So here are some basic examples of
how imports will work.
* `fa-address-book` becomes `import { faAddressBook } from '@fortawesome/fontawesome-free-solid'`
* `fa-facebook` becomes `import { faFacebookF } from '@fortawesome/fontawesome-free-brands'` (it's in the Brands style and this was renamed to facebook-f)
* `fa-freebsd` becomes `import { faFreebsd } from '@fortawesome/fontawesome-free-brands'` (OCD-warning: we know it's FreeBSD but consistency/guessability is the goal here)
## Alternative imports
Using `import { faAddressBook } from '@fortawesome/fontawesome-free-solid'` is great if you are using Webpack 2+ or Rollup which supports tree-shaking.
However if you cannot use this feature you can do the following to achieve the same result:
```javascript
import faUser from '@fortawesome/fontawesome-free-solid/faUser'
```
Or using `require`:
```javascript
var faUser = require('@fortawesome/fontawesome-free-solid/faUser')
```
## Configuration
Font Awesome 5 has several configuration options that affect how the library operates.
*Make sure you set your config as early as possible when using automatic CSS inserting* (more on this later)
In a browser the config is exported to `window.FontAwesomeConfig`.
Access the configuration in your app with:
```javascript
import fontawesome from '@fortawesome/fontawesome'
fontawesome.config
```
To update the configuration:
```javascript
import fontawesome from '@fortawesome/fontawesome'
fontawesome.config = {
familyPrefix: 'fa'
}
```
There is no need to send every possible config value when updating the config. Properties will
be merged with the existing properties and values.
### Options
**familyPrefix** default `fa`
* `String` used to prefix classes like `fa-spin`. Changing this would allow you
to still use Font Awesome 4 with the prefix of `fa`.
**replacementClass** default `svg-inline--fa`
* `String` used as the base class name when building the SVG elements. If you
changed this to `foo` the SVGs would start with `