mirror of
https://github.com/twitter/twemoji.git
synced 2024-12-28 06:18:30 +00:00
Use the regex from twemoji-parser in our generated code
This commit is contained in:
parent
fa2e812985
commit
f953ea2406
@ -39,14 +39,12 @@ require('child_process').spawn(
|
||||
'--verbose',
|
||||
file('twemoji.js'),
|
||||
'-o',
|
||||
file('twemoji.tmp.js')
|
||||
file('twemoji.min.js')
|
||||
]
|
||||
).on('close', function () {
|
||||
fs.writeFileSync(
|
||||
file('twemoji.min.js'),
|
||||
'/*! Copyright Twitter Inc. and other contributors. Licensed under MIT */\n' +
|
||||
fs.readFileSync(file('twemoji.tmp.js'))
|
||||
fs.readFileSync(file('twemoji.min.js')) + '\n'
|
||||
);
|
||||
fs.unlink(file('twemoji.tmp.js'));
|
||||
// gzip -c twemoji.min.js | wc -c
|
||||
});
|
@ -9,6 +9,7 @@ var fs = require('fs');
|
||||
var http = require('http');
|
||||
var path = require('path');
|
||||
var Utils = require('./utils');
|
||||
var regex = require('twemoji-parser/dist/lib/regex').default;
|
||||
|
||||
function file(which) {
|
||||
return path.join(__dirname, '../..', which);
|
||||
@ -1032,7 +1033,7 @@ function createTwemoji(re) {
|
||||
// drop current indentation
|
||||
.replace(/^ /gm, '')
|
||||
// add the RegExp in the right place
|
||||
.replace('re = /twemoji/', `re = /${fs.readFileSync(path.join(__dirname, 'regex')).toString().trim()}/g`)
|
||||
.replace('re = /twemoji/', `re = ${regex.toString()}`)
|
||||
// add the full license
|
||||
.replace('/*! (C) Twitter Inc. */',
|
||||
'/*! (C) Twitter Inc. *//*\n' +
|
||||
|
Loading…
Reference in New Issue
Block a user