Skip to content

Commit 3ddfb2a

Browse files
author
Nathan Downs
committed
Generate code to use the current version as the base URL
1 parent 635dfd8 commit 3ddfb2a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

scripts/generate

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ var http = require('http');
1010
var path = require('path');
1111
var Utils = require('./utils');
1212
var regex = require('twemoji-parser/dist/lib/regex').default;
13+
var { version } = require('../package.json');
1314

1415
function file(which) {
1516
return path.join(__dirname, '..', which);
@@ -46,7 +47,7 @@ function createTwemoji() {
4647
/////////////////////////
4748

4849
// default assets url, by default will be Twitter Inc. CDN
49-
base: 'https://twemoji.maxcdn.com/v/latest/',
50+
base: 'https://twemoji.maxcdn.com/v/$VERSION/',
5051

5152
// default assets file extensions, by default '.png'
5253
ext: '.png',
@@ -592,6 +593,7 @@ function createTwemoji() {
592593
.replace(/^ /gm, '')
593594
// add the RegExp in the right place
594595
.replace('re = /twemoji/', `re = ${regex.toString()}`)
596+
.replace('$VERSION', version)
595597
// add the full license
596598
.replace('/*! (C) Twitter Inc. */',
597599
'/*! (C) Twitter Inc. *//*\n' +

0 commit comments

Comments
 (0)