Online Font Awesome 5 Minimiser ("treeshaker")
Font Awesome 5 is great, but its very big. The SVG (javascript) free version is now over 1 MB, and the PRO version over 3 MB.
The javascript is made up of 30K of code, and the rest is SVG definitions of the 1,500 (4,500 - PRO) icons. This utility strips out all the icons you don't use, just leaving the 20 or so you actually need. This reduces the SVG/javascript file to 40K or so.
It works with both free and PRO versions.
[Jul-19] There is now an official solution for PRO users. A script that loads the core javascript, then reads through your HTML for icons, then loads their SVG's as needed. You are reliant upon their CDN for the code and SVG icon files however.
1 : Load the SVG Javascript file
Either:
- use the latest free version,
- choose your own version. This is the option for PRO users. The file you're looking for is fontawesome-pro/js/all.min.js Both normal and minified version work. Normal is only a little bigger, and it makes it easier to see what happening.
Now would be a good time for a cup of tea.
SVG/JS loaded : 0 K
2 : Make a list of the icons you use
3 : Minimise
This strips out the icons you are not using. You can tweak the 'keep' list above, and minimise again.
4 : Save
Tips:
- Check your browser's download area.
- Use right hand click | show in folder on the saved file, rather than open which will try and execute it.
- If you have problems, click inside the <textarea> below, use CTRL A to select all, then copy and paste.