New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

fontawesome-bundler

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fontawesome-bundler

Extract fontawesome icons which your project use into one bundle

  • 1.0.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
3
increased by200%
Maintainers
1
Weekly downloads
 
Created
Source

fontawesome-bundler

Extract used fontawesome icons into separate bundle

Why?

Fontawesome 5 with all icons weights a lot. And you, probably, as me don't need all of them - but only few from each fontawesome group.

Starting from version 5, fontaweome uses SVG icons which are described as node modules. Using this module you can find which icons are used in your project source files, like in templates, concat and append them into your main bundle. It helps to reduce your bundle size up to -400kb.

Installation

npm i -S fontawesome-bundler

Add task to your build tool:

  • Gulp:
var gulpUglify = require('gulp-uglify');
var gap = require('gulp-append-prepend');

var fontawesome = require('fontawesome-bundler');

gulp.task('vendor', function() {
  return fontawesome('src/templates/**/*.hbs')
      .then(function(icons) {
        return gulp.src('vendor/')
          .pipe(gulpConcat('vendor.js'))
          .pipe(gap.prependText(icons))
          .pipe(gulpUglify())
          .pipe(gulp.dest('build/js'));
      });
});

API

fontawesome(sourceDir or options)

  • sourceDir (String). Path to directory with html files or templates
  • options (Object). Additional options:
    • src (String). Path to directory with html files or templates
    • output (String). Possible values: string, array, object. Default value: string. Format of the output. If configured as string, plugin will return ready to inject source code.

Testing

npm test

License

MIT © 2018 Vitaliy Ribachenko vit@ribachenko.com

Keywords

FAQs

Package last updated on 08 Jan 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc