Permalink
Browse files

Merge pull request #56 from grimen/bugfix-missing-material-unicodes

bugfix: added missing unicode values for `material` icons
  • Loading branch information...
2 parents 555e6ff + dbda760 commit a1e2c4d71d54a0b7af8e3b37117c3890befdf364 @thomaspark committed Jan 24, 2016
Showing with 838 additions and 798 deletions.
  1. +39 −0 Gruntfile.js
  2. +791 −791 data/batch.json
  3. +3 −6 js/script.js
  4. +4 −0 package.json
  5. +1 −1 templates/batch.handlebars
View
@@ -82,4 +82,43 @@ module.exports = function(grunt) {
});
});
+
+ grunt.registerTask('map-unicodes-for-material-icons', function() {
+ var done = this.async();
+
+ var materialIconsData = require('./data/icons-material.json')
+
+ // console.log('IN', materialIconsData)
+
+ var fs = require('fs')
+ var cvsParse = require('csv-parse')
+
+ var writeStream = fs.createWriteStream('./data/icons-material.json')
+
+ var fontCodepointsParser = cvsParse({delimiter: ' ', columns: ['name', 'unicode']}, function(err, fontCodepoints){
+ // console.log('CODEPOINTS', fontCodepoints)
+
+ var fontCodepointsMap = {}
+
+ fontCodepoints.forEach(function(codepoint) {
+ fontCodepointsMap['' + codepoint.name] = codepoint.unicode
+ fontCodepointsMap['' + codepoint.unicode] = codepoint.name
+ })
+
+ materialIconsData.material.forEach(function(item) {
+ item.unicode = fontCodepointsMap[item.name]
+ // item.tags = ''
+ })
+
+ console.log('OUT', materialIconsData)
+
+ writeStream.write(JSON.stringify(materialIconsData, null, ' '), 'utf8')
+ writeStream.end()
+
+ done()
+ })
+
+ fs.createReadStream('./bower_components/material-design-icons/iconfont/codepoints').pipe(fontCodepointsParser)
+ });
+
};
Oops, something went wrong.

0 comments on commit a1e2c4d

Please sign in to comment.