Skip to content
Say hello to Web Awesome, the biggest and best library of open-source web components.
Pre-order today!
You're viewing the Version 5 Docs. View the latest

Sass (SCSS)

Are you using SCSS as a CSS preprocessor in your project? No problemo, Font Awesome has an SCSS version if you’d prefer to import our styling into your workflow.

We’ll cover the basics of picking the SCSS files you’ll need for your project, adding Font Awesome to your compile, inject code into a class with Mixins, and more.

How’s This Organized?

Here are some details on the mixins and files made specifically for SCSS.

FilesWhat They Do
fontawesome.scssMain Font Awesome compile
brands.scssBrands icon styles
solid.scssSolid icon styles
regular.scssRegular icon styles
light.scssLight icon styles
duotone.scssDuotone icon styles
_core.scssBase icon reference class syntax and definition
_mixins.scssUtilities used throughout styling/icon definitions
_icons.scssAll icon definitions
_variables.scssWhere variables are defined that are used throughout styling
_animated.scssanimated icon support styling
_bordered-pulled.scssbordered + pulled icon support styling
_fixed-width.scssfixed-width icon support styling
_larger.scssicon sizing support styling
_list.scssicons in a list support styling
_rotated-flipped.scssrotating icons support styling
_stacked.scssstacking icons support styling
_screen-reader.scssscreen-reader specific and accessibility support styling

Adding Font Awesome to Your Compile

Copy the scss folder into your project. Then copy the entire webfonts folder into your project where your static files get served.

Open your project’s scss/variables.scss and edit the $fa-font-path variable to point to where you placed the webfonts folder.

$fa-font-path: "../webfonts";

Import Font Awesome by adding @import "scss/fontawesome.scss" in your main SCSS file. Also, import one or more styles @import "scss/solid.scss" in your main SCSS file. Compile your code and get to using those new icons in your project!

Using Our Mixins

You can use @include fa-icon; to get things set up as an icon. Use @extend .fas; to create an icon in the Solid style. Import other styles to use other prefixes. Use fa-content and variable names to make including content values a little easier. Sass can be grumpy (or you know, Sassy) about this.

@import "./fontawesome/scss/fontawesome.scss";
@import "./fontawesome/scss/solid.scss";
@import "./fontawesome/scss/brands.scss";
.user {
@extend %fa-icon;
@extend .fas;
&:before {
content: fa-content($fa-var-user);
}
}
.twitter {
@extend %fa-icon;
@extend .fab;
&:before {
content: fa-content($fa-var-twitter);
}
}