gulpfile.babel.js
function generateIjmap(ijmapPath) {
  return through2.obj((codepointsFile, encoding, callback) => {
    const ijmap = {
      icons: codepointsToIjmap(codepointsFile.contents.toString())
    };

    callback(null, new File({
      path: ijmapPath,
      contents: new Buffer(JSON.stringify(ijmap), 'utf8')
    }));

    function codepointsToIjmap(codepoints) {
      return _(codepoints)
        .split('\n')       // split into lines
        .reject(_.isEmpty) // remove empty lines
        .reduce((codepointMap, line) => {   // build up the codepoint map
          let [ name, codepoint ] = line.split(' ');
          codepointMap[codepoint] = { name: titleize(humanize(name)) };
          return codepointMap;
        }, {});
    }
  });
}
function generateIjmap(ijmapPath) {
  return through2.obj((codepointsFile, encoding, callback) => {
    const ijmap = {
      icons: codepointsToIjmap(codepointsFile.contents.toString())
    };

    callback(null, new File({
      path: ijmapPath,
      contents: new Buffer(JSON.stringify(ijmap), 'utf8')
    }));

    function codepointsToIjmap(codepoints) {
      return _(codepoints)
        .split('\n')       // split into lines
        .reject(_.isEmpty) // remove empty lines
        .reduce((codepointMap, line) => {   // build up the codepoint map
          let [ name, codepoint ] = line.split(' ');
          codepointMap[codepoint] = { name: titleize(humanize(name)) };
          return codepointMap;
        }, {});
    }
  });
}
function generateIjmap ( ijmapPath ) { return through2 . obj ( ( codepointsFile , encoding , callback ) => { const ijmap = { icons : codepointsToIjmap ( codepointsFile . contents . toString ( ) ) } ; callback ( null , new File ( { path : ijmapPath , contents : new Buffer ( JSON . stringify ( ijmap ) , 'utf8' ) } ) ) ; function codepointsToIjmap ( codepoints ) { return _ ( codepoints ) . split ( '\n' ) // split into lines . reject ( _ . isEmpty ) // remove empty lines . reduce ( ( codepointMap , line ) => { // build up the codepoint map let [ name , codepoint ] = line . split ( ' ' ) ; codepointMap [ codepoint ] = { name : titleize ( humanize ( name ) ) } ; return codepointMap ; } , { } ) ; } } ) ; }
Returns a stream that transforms between our icon font's codepoint file
and an Iconjar ijmap.
Returns a stream that transforms between our icon font s codepoint file and an Iconjar ijmap .