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

emote-comments

v1.1.1

Published

A simple npm node integration for customizable emote comments and comments sections

Downloads

8

Readme

Emote Component

Pre-Req: Free Emote Account

Create an Account on Emote.com

Go to emote.com and create an account for your domain. It's easy, takes less than 1 minute, and is required for domains using Emote. This is also where you can manage moderation rules, settings, and import/export your data.

1. Installation

npm install emote-comments

2. Creating Emote Comments Section Component

Create or add a new file in your choice of framework as a container element as HTML.

Use a container tag; as the script is deferred and imported. In my example, I use TailwindCSS classes for layout and styling as shown, but you can create custom classes or design the container to fit your project needs.

The id declaration id="emote_com" will identify the container which imports the comments section. The container should be empty anmd can be used below as shown as a standalone component or added to an existing one that can be later imported to a file or page.

<!-- Emote / styles composed as TailwindCSS -->
<container id="emote_com" class="mx-auto w-2/3 flex"></container>

3. Importing Your Emote Component

Since Emote uses a deferred script, we reccomend importing it or the component that contains Emote directly to a page/file and not another component.

VanillaJs

// YourPage.js
import Emote from 'emote-comments';

document.addEventListener('DOMContentLoaded', () => {
  new Emote('emote_com');
});

JXS, TSX, and .astro usage example

// YourPage.(jsx/tsx/astro)
import Emote from 'emote-comments';
...
// location of comments section component
<Emote />

Handling Multiple Instances, Script-Handeling, and Re-Initialization

If your script or component may be instantiated multiple times on the same page, ensure your script loading mechanism checks if the script is already present or loaded to avoid loading it multiple times.

If you add additional script handeling or asynchrinization to your component or page, it's likely to affect the scripts deferred loading. You'll want to opt that component or tag out of any additional rules or project-wide script loading mechanisms to avoid conflicts.