generate.js 575 B

123456789101112131415161718192021
  1. var fs = require('fs');
  2. // Load emojis
  3. var emojis = JSON.parse(fs.readFileSync('../../emoji_strategy.json'), 'utf8');
  4. // Generate .scss mapping
  5. var mapping = '';
  6. for (var key in emojis) {
  7. if (emojis.hasOwnProperty(key))
  8. mapping += '"' + emojis[key].unicode + '": "' + key + "\",\n";
  9. }
  10. mapping = "$emoji-map: (\n" + mapping;
  11. mapping = mapping.substr(0, mapping.length - 2) + "\n);";
  12. // Write .scss file
  13. var output_path = '../../lib/emojione-awesome/_emojione-awesome.map.scss';
  14. fs.writeFileSync(output_path, mapping);
  15. console.log('Generated ' + output_path);