UNPKG

1.27 kBMarkdownView Raw
1#emoji-images.js
2
3Because sometimes you want to send a :heart: to someone.
4
5
6## What is this?
7
8Takes text, replaces all the texts here: http://www.emoji-cheat-sheet.com with an `<img>` tag containing the image.
9
10The images are all in the [](pngs) folder. Host those somewhere, pass the URL to the function. See below:
11
12
13## How to use it
14
15```js
16
17var string = 'a string containing emoji strings like :heart: and :trollface:';
18
19// the emoji function takes:
20// 1. The input string
21// 2. The url where the png files live
22// 3. (optionally) a size to specify as the height of the <img> tag.
23var emojified = emoji(string, 'http://url.com/where-you-put-the-pngs-folder/', 30);
24
25```
26
27It's bundled to work as a CommonJS module, AMD module or expose itself as a global as a fallback.
28
29## install
30
31Grab it here or on npm:
32
33```
34npm install emoji-images
35```
36
37## Why not just use https://github.com/hassankhan/emojify.js?
38
39I want it all in a super simple text processing (without the CSS and DOM stuff).
40
41Also, that solution embeds pngs as data-uri's in css documents. I don't want to do that because then I have to send all that image data to the browser even if they never get used.
42
43
44## Is it ready to use?
45
46Um... works for me™ (and in use on andbang.com)
47
48
49## License
50
51MIT