npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

emoji-web

v2.0.1

Published

Emoji library for use by JavaScript in browsers.

Downloads

8

Readme

emoji-web

Library to replace unicode emoji by pictures. Plus, the library contains images of emoji.

Designed for use Webpack.

Sprites and some code taken from the Telegram for Android.

Install

yarn add emoji-web
# or
npm install --save emoji-web

Usage

import emojiWeb from 'emoji-web';

const html = emojiWeb.replaceEmoji("Some ascii text... 🏠 😉 and unicode 😍 any symbols 💂", 32, 'some-custom-class');

/* returns:
	Some ascii text... <img src="/dist/img/0d23d0.gif" class="emoji-web some-custom-class" alt="🏠" style="height: 32px; width: 32px; background: url(/dist/img/a65648.png) -66px -297px / 297px;" draggable="false"/> ...and so on
*/

document.addEventListener("DOMContentLoaded", function() {
	var newBlock = document.createElement('div');
	newBlock.innerHTML = html;
	document.body.appendChild(newBlock);
});

Build

The build configuration should include the loader files and styles. Assume that build files should be in "dist" folder, then the minimum required configuration will look as shown below (webpack.config.js):

var ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
	entry: './index.js',
	output: {
		filename: './dist/index.js'
	},
	module: {
		rules: [
			{
				test: /\.css$/,
				use: ExtractTextPlugin.extract({
					fallback: 'style-loader',
					use: 'css-loader'
				})
			},
			{
				test: /\.(png|gif)$/,
				loader: 'file-loader',
				options: {
					publicPath: '/',
					outputPath: 'dist/img/',
					name: '[hash:6].[ext]'
				}
			}
		]
	},
	plugins: [
		new ExtractTextPlugin({
			filename: 'dist/index.css',
			disable: false,
			allChunks: true,
			ignoreOrder: true
		})
	],

};

Demo

You can run the demo. To do this, simply run the commands:

cd emoji-web/demo
yarn
yarn start