We provide more advanced packages that are suitable for more specialized situations. These packages are side-effect free and provide no automatic replacement of <i> tags to <svg> tags (although it can still be used through dom.watch()).

Advertisement

Check out the API for detailed docs

The @fortawesome/fontawesome-svg-core package documentation can be found in our Javascript API Docs.

What's SVG Core for?

The SVG core package is helpful and recommended in the following cases:

These are ES6 module compatible for tools that support this, such as Rollup. Our icon content packages also support tree shaking which allows compatible tools to remove icons you are not using from your final build.

Advertisement

Comparing the Basic Packages and SVG Core

Our Basic packages (@fortawesome/fontawesome-free and @fortawesome/fontawesome-pro) are aimed at individuals who would like to quickly integrate Font Awesome into their projects but do not want to invest the time and effort to understand what's going on under the hood. For this reason a lot of the behavior is automatic and works without any intervention.

In contrast, the fontawesome-svg-core package is for more specialized situations or for forming the underlying API to power other components or libraries. In fact, our own official components for Vue, React, Ember, and Angular all use the fontawesome-svg-core package under the hood.

Because of this the core package and the icon content packages avoid doing anything automatic or creating side-effects that make development with them difficult to control or reason.

One of the most common use cases where you would reach for the core package instead of using fontawesome-free or fontawesome-pro is to create a subset of icons to reduce your final bundled file size.

For this case you may still want the <i> tags to be replaced with <svg> tags. This is the default behavior when using the CDN or fontawesome-free and fontawesome-pro packages. This does not happen automatically when using the core package.

To accomplish this we will use the dom API.

import { library, dom } from '@fortawesome/fontawesome-svg-core'
import { faUserAstronaut } from '@fortawesome/free-solid-svg-icons'

// We are only using the user-astronaut icon
library.add(faUserAstronaut)

// Replace any existing <i> tags with <svg> and set up a MutationObserver to
// continue doing this as the DOM changes.
dom.watch()

You're viewing the Version 6 Beta

It's all the awesome of 5, but now more six-y! Version 6 brings over 13,000 icons across 5 styles – including the new Thin style! – and includes more and faster services.

Get the Deets on Version 6

Head Back to Our Current Version 5 Release

Need a Hand?

If you’re stuck or have a question, check our Troubleshooting docs, all of the Font Awesome threads on Stack Overflow, or contact our community on GitHub.

Or get Real Human Support™ with a Pro Subscription!