Skip to content
This repository has been archived by the owner on Feb 2, 2024. It is now read-only.

Latest commit

 

History

History
30 lines (23 loc) · 1.19 KB

README.md

File metadata and controls

30 lines (23 loc) · 1.19 KB

FA-Minify

Install

npm i gulp-fa-minify

Description

A utility Gulp plugin to remove unused Icons from FontAwesome 5/6 when using SVG with JavaScript.

The JavaScript files included in FontAwesome 5/6 can lead to a bundle size increase of ~900kb (or even >2.5MB if you have Access to the Pro Version). Only including the needed Icons can lead to a massive size reduction and performance increase.

Use it as a normal gulp plugin in your workflow:

  const usedIcons = {
    fal: [],
    far: ['copy'],
    fas: ['copy', 'gears', 'address-book'],
    fab: []
  };

  return gulp.src('./path/to/font-awesome/all.js')
    .pipe(faMinify(usedIcons))
    .pipe(gulp.dest('./'));

(Full Example: gulpfile.js )

Attention: Only works with the non minified JavaScript files because this plugin uses regular expressions to find the defined icons. But adding the gulp-uglify for example is a simple one-liner.