gulp-icomoon-builder

1.0.0 • Public • Published

gulp-icomoon-builder

This module is used for automate Icomoon integration with your SCSS project.

Instalation

npm install gulp-icomoon-builder

Usage

You can use this module in two ways:

SCSS way:

You can create gulp task and add it to watcher. Task example:

const icomoonBuilder = require('gulp-icomoon-builder');

gulp.task('build-fonts', () => {
  gulp.src('./path_to_font/icomoon/selection.json')
    .pipe(icomoonBuilder({
      templateType: 'map',
      extraIcons: {
        'custom-icon-1': '\f2b9',
        'custom-icon-2': '\f2ba',
      },
    }))
    .on('error', function (error) {
      console.log(error);
      // or if you use "gulp-notify"
      notify().write(error);
    })

    .pipe(gulp.dest('scss'))
    .on('error', function (error) {
      console.log(error)
      notify().write(error);
    });
});

SVG Sprite way:

Note: Parameter extraIcons not working for svg sprites

const icomoonBuilder = require('gulp-icomoon-builder');

gulp.task('build-svg-sprite', () => {
  gulp.src('./path_to_font/icomoon/selection.json')
    .pipe(icomoonBuilder({
      templateType: 'svg',
      filename: 'icons.svg',
    }))
    .on('error', function (error) {
      console.log(error);
      // or if you use "gulp-notify"
      notify().write(error);
    })

    .pipe(gulp.dest('icons'))
    .on('error', function (error) {
      console.log(error)
      notify().write(error);
    });
});

Options

Option Type Default Description
templateType string map Type of the template. Can be map, var or svg
externalTemplare string none Path to custom Mustache template. See /templates folder
filename string _icons.scss Name of your file.
extraIcons object {} Additional icons that aren't included in your Icomoon project

Package Sidebar

Install

npm i gulp-icomoon-builder

Weekly Downloads

275

Version

1.0.0

License

MIT

Last publish

Collaborators

  • varjat