Giter VIP home page Giter VIP logo

emojize's Introduction

Emojize

High resolution, unicode (emoji) to html conversion utility

npm install emojize --save
var convert = require('emojize').emojize
var html = convert('Haay ๐Ÿ˜œ. Just getting โ˜•. But maybe ๐Ÿป at ๐Ÿ•˜๐ŸŒœ is that ๐Ÿ†’')

Browser usage with Ender

ender add emojize

Note

Use of this library requires <meta charset='utf-8'> encoding if used in a browser.

<head>
  <meta charset='utf-8'>
  <link href='sprite/emoji.css' type='text/css'>
  <script src='ender.js'></script>
</head>
var convert = require('emojize').emojize
document.getElementById('content').innerHTML = convert('Haay ๐Ÿ˜œ')

Sprite vs Image

emojize defaults to sprite based conversion which ultimately requires the developer to include the sprite/emoji.css and upload the emoji.png along side the file. You could otherwise include all images found in img/ and pass in flag to the second argument to emojize

var emo = require('emojize')
emo.base('images/emojis/')
emo.emojize('Haay ๐Ÿ˜œ', true)

/**
 * outputs:
 * 'Haay <img src="images/emojis/_1f61c.png">'
 */

Examples

make build
make example
open http://localhost:3000/example.jade

Screenshot

Sizing

Each emoji defaults to 64px ร— 64px which may not always be desired. Thus, consider the following practice. Example assumes LESS.

.quarter { zoom: 0.25 }
.half { zoom: 0.5 }
.three-quarter { zoom: 0.75 }
.full { zoom: 1 }

@media screen and (max-width: 768px) {
  .emoji {
    .quarter()
  }
}

@media screen and (max-width: 992px) {
  .emoji {
    .half()
  }
}
@media screen and (max-width: 1200px) {
  .emoji {
    .three-quarter()
  }
}
@media screen and (max-width: 1600px) {
  .emoji {
    .full()
  }
}

Credits

Much thanks to Gemoji project for high resolution images and Apple Inc. for Artwork. See License

Happy Emojizing!

emojize's People

Contributors

ded avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.