As many already know, Elementor is very reluctant to stay up-to-date with their CMS. It still uses Font Awesome version 5 and if you don't have a Pro license for Font Awesome, it is very difficult to integrate FA6 as icons.
So to help fellow developers, here is how you can do it!
In Elementor you can import icon sets that are exported by Fontello (as ZIP).
Because Fontello does not support FA6, you have to generate this ZIP file yourself.
We will do this using Node and Gulp.
a. Create a new folder
b. Inside this folder, initiate a new NPM project that uses Gulp by following the installation documentation here.
c. Install the following dependencies:
npm install --save-dev gulp-concat gulp-rename del sass gulp-sass gulp-postcss postcss-url autoprefixer cssnano gulp-zip
Download the full Font Awesome 6 repository as ZIP and extract these files to you project folder:
/scss/*
/webfonts/*
/metadata/icon-families.json
At the end of scss/_variables.scss
, add these variables:
$fa-css-prefix: fa6;
$fa-font-path: "../font";
$fa-font-display: swap; // Optional
For example, for sharp light:
.fasl,
.#{$fa-css-prefix}-light {
--#{$fa-css-prefix}-style: 300; // <-- Add this line with the correct font-weight number
font-weight: 300;
}
at the end of scss/sharp-light.scss
.
Do this for all font/icon styles you need.
Copy the source code from the gulpfile.mjs
below and save this file in your project folder.
Your project folder should now look like this:
metadata/icon-families.json
node_modules/**
scss/*.scss
webfonts/*.(ttf|woff2)
package.json
gulpfile.mjs
gulp
If all goes well, you now have an output
folder containing folders for each Font Awesome icon set and their zipped version.
output/brands.zip
output/brands/config.json
output/brands/css/brands.css
output/brands/font/fa-brands*
output/regular.zip
...etc
Import the ZIP file of each icon set following the steps mentioned here.
Now you can finally enjoy the latest Font Awesome icons inside your Elementor website:
(Although odds are Elementor will find a way to mess up their code and this will not work anymore..🤷♂️)
So, there are 2 issues that disturb the normal use of custom icons:
1) Incorrect setting and overwriting of CSS classes and declarations
a. Elementor (as it would..) has a very faulty and inconsistent way of loading these icons, making it like tip-toeing to get it to work.
There are certain names you can't use, because apparently they are use behind the scenes for the included free FA 5 icons (which you can't disable).
The icon list sets the icon's classes to
prefix
+name
and addsprefix_wituout_dashes
(when there is no displayPrefix, like with the FA 5 ones) just to f*ck with all devs (see source code here and here).Example: (correct)
fa6-solid fa6-360-degrees
+ (incorrect)fa6solid fa6
=fa6solid fa6 fa6-solid fa6-360-degrees
This additional
fa6
class is what makes the same font show for different icon styles (see next point).b. Font Awesome's weight declarations
font-weight
attribute is overwritten by the general.fa6
class (from above).--fa6-style
variable (fa6 is chosen prefix).To fix this, add the variable declaration to each individual font style SCSS.
Here is the example for sharp light at the bottom of
scss/sharp-light.scss
:2) Some limitation in Elementor's editor
The editor throws an error when loading the icons picker tool in the side menu.
It seems the amount of icons is simply too much for this editor to handle.
In my case,
sharp thin
andduotone
where empty/could not load. (Even though both display correctly in the WP admin backend.)Maybe just choosing to add only the icon styles you need, might fix this issue?
Either way, this is simply ridiculous, but since Elementor is scripted by AI or Microsoft's Clippy, it's up to us to make it decent and working. Good luck!💪