1 | #emoji-images.js
|
2 |
|
3 | Because sometimes you want to send a :heart: to someone.
|
4 |
|
5 |
|
6 | ## What is this?
|
7 |
|
8 | Takes text, replaces all the texts here: http://www.emoji-cheat-sheet.com with an `<img>` tag containing the image.
|
9 |
|
10 | The 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 |
|
17 | var 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.
|
23 | var emojified = emoji(string, 'http://url.com/where-you-put-the-pngs-folder/', 30);
|
24 |
|
25 | ```
|
26 |
|
27 | It's bundled to work as a CommonJS module, AMD module or expose itself as a global as a fallback.
|
28 |
|
29 | ## install
|
30 |
|
31 | Grab it here or on npm:
|
32 |
|
33 | ```
|
34 | npm install emoji-images
|
35 | ```
|
36 |
|
37 | ## Why not just use https://github.com/hassankhan/emojify.js?
|
38 |
|
39 | I want it all in a super simple text processing (without the CSS and DOM stuff).
|
40 |
|
41 | Also, 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 |
|
46 | Um... works for me™ (and in use on andbang.com)
|
47 |
|
48 |
|
49 | ## License
|
50 |
|
51 | MIT
|