1
0
mirror of https://github.com/twitter/twemoji.git synced 2024-07-01 02:19:09 +00:00

Generate code to use the current version as the base URL

This commit is contained in:
Nathan Downs 2019-07-01 16:58:31 -07:00
parent 635dfd8f32
commit 3ddfb2ac3b

View File

@ -10,6 +10,7 @@ var http = require('http');
var path = require('path');
var Utils = require('./utils');
var regex = require('twemoji-parser/dist/lib/regex').default;
var { version } = require('../package.json');
function file(which) {
return path.join(__dirname, '..', which);
@ -46,7 +47,7 @@ function createTwemoji() {
/////////////////////////
// default assets url, by default will be Twitter Inc. CDN
base: 'https://twemoji.maxcdn.com/v/latest/',
base: 'https://twemoji.maxcdn.com/v/$VERSION/',
// default assets file extensions, by default '.png'
ext: '.png',
@ -592,6 +593,7 @@ function createTwemoji() {
.replace(/^ /gm, '')
// add the RegExp in the right place
.replace('re = /twemoji/', `re = ${regex.toString()}`)
.replace('$VERSION', version)
// add the full license
.replace('/*! (C) Twitter Inc. */',
'/*! (C) Twitter Inc. *//*\n' +