packages/plugin-icon-font/icon-font.js
function icons(done) {
    const stream = gulp.src(config.src)
      .pipe(iconfont({
        fontName: config.iconName,
        appendUniconde: true,
        formats: config.formats,
        timestamp: config.useTimestamp ? getTimestamp() : 0,
        autohint: config.autohint,
        normalize: config.normalize,
      }));
    // write icons to disk
    stream.pipe(gulp.dest(config.dest));

    // reload browser
    core.events.emit('reload');

    if (config.templates.enabled && config.templates.sets.length) {
      stream.on('glyphs', (glyphs) => {
        // console.log(glyphs);
        const iconData = {
          glyphs: glyphs.map(glyph => ({ // returns the object
            name: glyph.name,
            content: glyph.unicode[0].toString(16).toUpperCase(),
          })),
          fontName: config.iconName,
          fontPath: config.fontPathPrefix,
          classNamePrefix: config.classNamePrefix,
        };

        Promise.all(config.templates.sets.map(set => new Promise((resolve, reject) => {
          processIconTemplate(set.src, set.dest, iconData, (err) => {
            if (err) reject();
            resolve();
          });
        }))).then(() => done());
      });
    } else {
      done();
    }
  }
function icons(done) {
    const stream = gulp.src(config.src)
      .pipe(iconfont({
        fontName: config.iconName,
        appendUniconde: true,
        formats: config.formats,
        timestamp: config.useTimestamp ? getTimestamp() : 0,
        autohint: config.autohint,
        normalize: config.normalize,
      }));
    // write icons to disk
    stream.pipe(gulp.dest(config.dest));

    // reload browser
    core.events.emit('reload');

    if (config.templates.enabled && config.templates.sets.length) {
      stream.on('glyphs', (glyphs) => {
        // console.log(glyphs);
        const iconData = {
          glyphs: glyphs.map(glyph => ({ // returns the object
            name: glyph.name,
            content: glyph.unicode[0].toString(16).toUpperCase(),
          })),
          fontName: config.iconName,
          fontPath: config.fontPathPrefix,
          classNamePrefix: config.classNamePrefix,
        };

        Promise.all(config.templates.sets.map(set => new Promise((resolve, reject) => {
          processIconTemplate(set.src, set.dest, iconData, (err) => {
            if (err) reject();
            resolve();
          });
        }))).then(() => done());
      });
    } else {
      done();
    }
  }
Build font icons from SVG files and optionally make scss and demo templates.
@param done {function} - Callback when all done.