Skip to content
This repository has been archived by the owner on Feb 2, 2024. It is now read-only.
/ gulp-fa-minify Public archive

Minify the FontAwesome 5 JavaScript Library with this simple Gulp plugin

Notifications You must be signed in to change notification settings

FA-Minify/gulp-fa-minify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.