mirror of
https://github.com/twitter/twemoji.git
synced 2024-12-29 00:22:57 +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',
|
'--verbose',
|
||||||
file('twemoji.js'),
|
file('twemoji.js'),
|
||||||
'-o',
|
'-o',
|
||||||
file('twemoji.tmp.js')
|
file('twemoji.min.js')
|
||||||
]
|
]
|
||||||
).on('close', function () {
|
).on('close', function () {
|
||||||
fs.writeFileSync(
|
fs.writeFileSync(
|
||||||
file('twemoji.min.js'),
|
file('twemoji.min.js'),
|
||||||
'/*! Copyright Twitter Inc. and other contributors. Licensed under MIT */\n' +
|
'/*! 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 http = require('http');
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var Utils = require('./utils');
|
var Utils = require('./utils');
|
||||||
|
var regex = require('twemoji-parser/dist/lib/regex').default;
|
||||||
|
|
||||||
function file(which) {
|
function file(which) {
|
||||||
return path.join(__dirname, '../..', which);
|
return path.join(__dirname, '../..', which);
|
||||||
@ -1032,7 +1033,7 @@ function createTwemoji(re) {
|
|||||||
// drop current indentation
|
// drop current indentation
|
||||||
.replace(/^ /gm, '')
|
.replace(/^ /gm, '')
|
||||||
// add the RegExp in the right place
|
// 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
|
// add the full license
|
||||||
.replace('/*! (C) Twitter Inc. */',
|
.replace('/*! (C) Twitter Inc. */',
|
||||||
'/*! (C) Twitter Inc. *//*\n' +
|
'/*! (C) Twitter Inc. *//*\n' +
|
||||||
|
Loading…
Reference in New Issue
Block a user