forked from jcubic/jquery.terminal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmkemoji
executable file
·27 lines (25 loc) · 1.01 KB
/
mkemoji
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env node
const http = require('https');
const url = require('url');
const emoji = require('emoji-datasource-twitter');
if (process.argv.length === 3) {
console.log([
'/*',
' * Autogenerated by mkemoji script from jQuery Terminal',
' * Copyright (C) Jakub T. Jankiewicz <https://jcubic.pl>',
' * ship with version: ' + process.argv[2],
' * build: ' + new Date().toUTCString(),
' */'].join('\n'));
emoji.map(function(emoji) {
var url = 'https://unpkg.com/emoji-datasource-twitter/img/' +
'twitter/64/' + emoji.image;
// escape special characters in class name
// https://mathiasbynens.be/notes/css-escapes
var class_name = emoji.short_name.replace(/\+/g, '\\+')
.replace(/^(\d)/i, '\\3$1 ');
var selector = [
'.terminal-output>:not(.raw) .emoji.' + class_name,
'.cmd .emoji.' + class_name].join(',');
console.log(`${selector}{background-image:url(${url});}`);
});
}