mirror of
https://github.com/twitter/twemoji.git
synced 2024-06-15 03:35:16 +00:00
44 lines
1.0 KiB
Plaintext
44 lines
1.0 KiB
Plaintext
|
#!/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');
|
||
|
var path = require('path');
|
||
|
|
||
|
function file(which) {
|
||
|
return path.join(__dirname, '..', which);
|
||
|
}
|
||
|
|
||
|
fs.readdir(file('assets'), function (err, files) {
|
||
|
var page = fs.readFileSync(file('templates/preview.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(
|
||
|
file('test/preview.html'),
|
||
|
page.replace(
|
||
|
'{{emoji-options}}',
|
||
|
JSON.stringify({
|
||
|
size: 72
|
||
|
})
|
||
|
)
|
||
|
);
|
||
|
fs.writeFileSync(
|
||
|
file('test/preview-svg.html'),
|
||
|
page.replace(
|
||
|
'{{emoji-options}}',
|
||
|
JSON.stringify({
|
||
|
folder: 'svg',
|
||
|
ext: '.svg',
|
||
|
base: ''
|
||
|
})
|
||
|
)
|
||
|
);
|
||
|
});
|