diff --git a/scripts/preview b/scripts/preview
index 9bebddf7..dfdcf8f6 100755
--- a/scripts/preview
+++ b/scripts/preview
@@ -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}}',
- '
' + 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 '' + codepoint.toUpperCase() + ';';
- }).join('');
- }).join('\n ')+ ''
- );
+ var page = fs.readFileSync(file('src/templates/preview.html'))
+ .toString()
+ .replace(
+ '{{emoji-list}}',
+ '' + 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 '' + codepoint.toUpperCase() + ';';
+ }).join('');
+ }).join('\n ')+ ''
+ )
+ .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'),
diff --git a/src/templates/preview.html b/src/templates/preview.html
index b3a58f26..01a6cd35 100644
--- a/src/templates/preview.html
+++ b/src/templates/preview.html
@@ -25,7 +25,7 @@
vertical-align: -0.1em;
}
-
+