1
0
mirror of https://github.com/twitter/twemoji.git synced 2024-11-19 11:14:59 +00:00
twemoji/preview-generator.js

39 lines
916 B
JavaScript
Raw Normal View History

#!/usr/bin/env node
/*! Copyright Twitter Inc. and other contributors. Licensed under MIT *//*
https://github.com/twitter/twemoji/blob/gh-pages/LICENSE
*/
// dependencies
var fs = require('fs');
2015-04-09 10:57:30 +00:00
fs.readdir('./assets', function (err, files) {
var page = fs.readFileSync('./preview-template.html').toString().replace(
'{{emoji-list}}',
'<li>' + files.map(function (file) {
return file.replace('.ai', '').split('-').map(function (hex) {
return '&#x' + hex.toUpperCase() + ';';
}).join('');
}).join('</li>\n <li>')+ '</li>'
);
fs.writeFileSync(
'./preview.html',
2015-04-09 10:57:30 +00:00
page.replace(
'{{emoji-options}}',
JSON.stringify({
size: 72
})
)
);
fs.writeFileSync(
'./preview-svg.html',
page.replace(
'{{emoji-options}}',
JSON.stringify({
folder: 'svg',
ext: '.svg',
base: ''
})
)
);
});