mirror of
https://github.com/twitter/twemoji.git
synced 2024-12-25 15:14:19 +00:00
Generate the preview pages based on the current version
This commit is contained in:
parent
3ddfb2ac3b
commit
53ac4682ff
@ -9,7 +9,7 @@ var fs = require('fs');
|
||||
var path = require('path');
|
||||
var { parse } = require('twemoji-parser');
|
||||
var Utils = require('./utils');
|
||||
|
||||
var { version } = require('../package.json');
|
||||
|
||||
function file(which) {
|
||||
return path.join(__dirname, '..', which);
|
||||
@ -20,21 +20,24 @@ function distFile(...which) {
|
||||
}
|
||||
|
||||
fs.readdir(file('assets/ai'), function (err, files) {
|
||||
var page = fs.readFileSync(file('src/templates/preview.html')).toString().replace(
|
||||
'{{emoji-list}}',
|
||||
'<li>' + files.map(function (filename) {
|
||||
var codepoints = filename.replace('.ai', '').split('-');
|
||||
var emoji = codepoints.map(function(codepoint) {
|
||||
return Utils.fromCodePoint(codepoint);
|
||||
}).join('');
|
||||
if (parse(`${emoji}\ufe0f`).length === 1) {
|
||||
codepoints.push('fe0f');
|
||||
}
|
||||
return codepoints.map(function (codepoint) {
|
||||
return '&#x' + codepoint.toUpperCase() + ';';
|
||||
}).join('');
|
||||
}).join('</li>\n <li>')+ '</li>'
|
||||
);
|
||||
var page = fs.readFileSync(file('src/templates/preview.html'))
|
||||
.toString()
|
||||
.replace(
|
||||
'{{emoji-list}}',
|
||||
'<li>' + files.map(function (filename) {
|
||||
var codepoints = filename.replace('.ai', '').split('-');
|
||||
var emoji = codepoints.map(function(codepoint) {
|
||||
return Utils.fromCodePoint(codepoint);
|
||||
}).join('');
|
||||
if (parse(`${emoji}\ufe0f`).length === 1) {
|
||||
codepoints.push('fe0f');
|
||||
}
|
||||
return codepoints.map(function (codepoint) {
|
||||
return '&#x' + codepoint.toUpperCase() + ';';
|
||||
}).join('');
|
||||
}).join('</li>\n <li>')+ '</li>'
|
||||
)
|
||||
.replace('{{version}}', version);
|
||||
fs.writeFileSync(
|
||||
distFile('preview.html'),
|
||||
page.replace(
|
||||
@ -43,6 +46,7 @@ fs.readdir(file('assets/ai'), function (err, files) {
|
||||
size: 72
|
||||
})
|
||||
)
|
||||
|
||||
);
|
||||
fs.writeFileSync(
|
||||
distFile('preview-svg.html'),
|
||||
|
@ -25,7 +25,7 @@
|
||||
vertical-align: -0.1em;
|
||||
}
|
||||
</style>
|
||||
<script src="https://twemoji.maxcdn.com/v/latest/twemoji.min.js" crossorigin="anonymous"></script>
|
||||
<script src="https://twemoji.maxcdn.com/v/{{version}}/twemoji.min.js" crossorigin="anonymous"></script>
|
||||
</head>
|
||||
<body>
|
||||
<ul class="emoji-list">
|
||||
|
Loading…
Reference in New Issue
Block a user