GithubHelp home page GithubHelp logo

pprince / gulp-svgicons2svgfont Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nfroidure/gulp-svgicons2svgfont

0.0 0.0 0.0 130 KB

Bundle several SVG icons to a single SVG font

License: MIT License

gulp-svgicons2svgfont's Introduction

gulp-svgicons2svgfont

Create an SVG font from several SVG icons with Gulp.

NPM version Build status Dependency Status devDependency Status Coverage Status Code Climate

Usage

First, install gulp-svgicons2svgfont as a development dependency:

npm install --save-dev gulp-svgicons2svgfont

Then, add it to your gulpfile.js:

var svgicons2svgfont = require('gulp-svgicons2svgfont');

gulp.task('Iconfont', function(){
  gulp.src(['assets/icons/*.svg'])
    .pipe(svgicons2svgfont({
      fontName: 'myfont'
     }))
    .on('codepoints', function(codepoints) {
      console.log(codepoints);
      // Here generate CSS/SCSS  for your codepoints ...
    })
    .pipe(gulp.dest('www/font/'));
});

Every icon must be prefixed with it's codepoint. The appendCodepoints option allows to do it automatically. Then, in your own CSS, you just have to use the corresponding codepoint to display your icon. See this sample less mixin for a real world usage.

The plugin stream emits a codepoints event letting you do whatever you want with them.

Please report icons to font issues to the svgicons2svgfont repository on wich this plugin depends.

API

svgicons2svgfont(options)

options.fontName

Type: String Default value: 'iconfont'

A string value that is used to name your font-family (required).

options.fixedWidth

Type: Boolean Default value: false

Creates a monospace font of the width of the largest input icon.

options.fontHeight

Type: Number

The ouputted font height (defaults to the height of the highest input icon).

options.descent

Type: Number Default value: 0

The font descent. It is usefull to fix the font baseline yourself.

The ascent formula is : ascent = fontHeight - descent.

options.appendCodepoints

Type: Boolean Default value: false

Allow to append codepoints to icon files in order to always keep the same codepoints.

options.ignoreExt

Type: Boolean Default value: false

Set to true to also convert read icons that doesn't have the .svg extension.

Stats

NPM NPM

gulp-svgicons2svgfont's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.