npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gulp-svgicons2svgfont2

v4.0.2

Published

Create a SVG font from several SVG icons

Downloads

1

Readme

gulp-svgicons2svgfont

Create an SVG font from several SVG icons with Gulp.

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

You can test this library with the frontend generator.

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('glyphs', function(glyphs) {
      console.log(glyphs);
      // Here generate CSS/SCSS  for your glyphs ...
    })
    .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. Note this Gulp plugin is strictly equivalent to the above module CLI interface.

API

svgicons2svgfont(options)

options.ignoreExt

Type: Boolean Default value: false

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

options.prependUnicode

Type: Boolean Default value: false

Allow to prepend unicode codepoints to icon file names in order to always keep the same codepoints accross each run.

options.fileName

Type: String Default value: options.fontName

Allows to specify a fileName if needed it to be different from the fontName, eg. do not want to have spaces.

options.startUnicode

Type: integer Default value: 0xEA01

Starting codepoint used for the generated glyphs. Defaults to a region within the Unicode private use area which is currently unused. See this blog post for further details and additional suggestions regarding accessibility of icon fonts.

options.metadataProvider

Type: Function Default value: require('svgicons2svgfont/src/metadata')(options)

Allows to define your own logic to attach codepoints to input files.

options.*

The svgfont2svgicons options are also available:

  • options.fontName (required)
  • options.fileName
  • options.fontWeight
  • options.fontStyle
  • options.fixedWidth
  • options.centerHorizontally
  • options.normalize
  • options.fontHeight
  • options.round
  • options.descent
  • options.metadata
  • options.log

Note

You may look after a full Gulp web font workflow, see gulp-iconfont fot that matter.

Stats

NPM NPM

Contributing

Feel free to push your code if you agree with publishing under the MIT license.