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 🙏

© 2026 – Pkg Stats / Ryan Hefner

redditify

v0.2.2

Published

A vanilla JS package for embedding Reddit threads on any webpage

Readme

Redditify

A vanilla JavaScript package that allows rendering arbitrary Reddit threads on any webpage. The package fetches JSON data from Reddit and renders a UI that closely resembles the original Reddit thread design, without any framework dependencies.

Features

  • 🧵 Render any Reddit thread by providing its URL
  • 💫 No Reddit API key needed
  • 🔄 Client side rendering
  • 📱 Responsive design that works on mobile and desktop
  • 🌙 Supports light and dark mode
  • 🧩 Easy to embed on any webpage
  • 📂 Collapsible comments - hide/show comment content and replies
  • 🔗 Optional attribution link - can be turned on/off

Installation

npm install redditify
# or
yarn add redditify
# or
pnpm add redditify

When using the JavaScript API, don't forget to import the CSS:

import 'redditify/dist/redditify.css';

The auto-embedding script includes the CSS automatically, so you don't need to import it separately.

CDN Usage

For quick implementation without npm, you can use the CDN version:

<!-- Include from CDN -->
<script src="https://cdn.jsdelivr.net/npm/redditify/dist/redditify.min.js"></script>

Usage

Auto-Embedding Script

You can use the auto-embedding script to automatically render Reddit threads on any HTML page without writing any JavaScript code. This is the simplest way to embed Reddit threads on your website.

Basic Usage

  1. Include the Reddit Thread Viewer script and css:
<script src="//unpkg.com/redditify/dist/redditify.min.js"></script>
<link rel="stylesheet" href="//unpkg.com/redditify/dist/redditify.css">
  1. Add divs with the data-reddit-thread attribute:
<div 
  data-reddit-thread="https://www.reddit.com/r/PHP/comments/1m78ww6/morethanone_class_per_file_motoautoload"
></div>

Complete HTML Example

Here's a complete HTML example:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Reddit Thread Example</title>
  <!-- Include Redditify -->
  <script src="https://unpkg.com/redditify/dist/redditify.min.js"></script>
  <link rel="stylesheet" href="https://unpkg.com/redditify/dist/redditify.css">
</head>
<body>
  <h1>Reddit Thread Example</h1>
  
  <!-- Reddit thread will be rendered here -->
  <div 
    data-reddit-thread="https://www.reddit.com/r/PHP/comments/1m78ww6/morethanone_class_per_file_motoautoload"
    data-reddit-max-depth="5"
    data-reddit-show-content="true"
    data-reddit-show-controls="true"
  ></div>
</body>
</html>

Advanced Usage

You can customize the thread display with additional data attributes:

<div 
  data-reddit-thread="https://www.reddit.com/r/PHP/comments/1m78ww6/morethanone_class_per_file_motoautoload"
  data-reddit-max-depth="3"
  data-reddit-show-content="true"
  data-reddit-show-controls="true"
  data-reddit-show-attribution="true"
></div>

JavaScript API Usage

If you need more control, you can use the JavaScript API directly:

import { createRedditThread } from 'redditify';
import 'redditify/dist/redditify.css'; // Import styles

// Get a container element
const container = document.getElementById('thread-container');

// Render the Reddit thread
createRedditThread({ 
  url: 'https://www.reddit.com/r/PHP/comments/1m78ww6/morethanone_class_per_file_motoautoload',
  maxCommentDepth: 3, // Limit comment nesting depth
  showPostContent: true, // Show or hide the post content
  showCommentControls: true, // Show or hide comment controls
  showAttribution: true, // Show or hide attribution link
  onError: (error) => console.error('Error loading thread:', error)
}, container);

Available Data Attributes

| Attribute | Type | Default | Description | |-----------|------|---------|-------------| | data-reddit-thread | URL | (required) | URL of the Reddit thread to render | | data-reddit-max-depth | Number | 5 | Maximum depth of nested comments to display | | data-reddit-show-content | Boolean | true | Whether to show the post content | | data-reddit-show-controls | Boolean | true | Whether to show comment controls | | data-reddit-show-attribution | Boolean | true | Whether to show the attribution link at the bottom |

Collapsible Comments

Redditify supports collapsible comments. Users can click the [-] button next to a comment author to collapse both the comment content and its replies. This is particularly useful for long threads with many nested comments.

Attribution Link

By default, Redditify adds a small attribution link at the bottom of the widget. You can disable this by setting data-reddit-show-attribution="false" or showAttribution: false in the JavaScript API.

JavaScript API Options

When using the createRedditThread function, you can pass the following options:

| Option | Type | Default | Description | |--------|------|---------|-------------| | url | string | (required) | URL of the Reddit thread to render | | maxCommentDepth | number | 5 | Maximum depth of nested comments to display | | showPostContent | boolean | true | Whether to show the post content | | showCommentControls | boolean | true | Whether to show comment controls (collapse, etc.) | | showAttribution | boolean | true | Whether to show the attribution link at the bottom | | onError | (error: Error) => void | undefined | Callback function when an error occurs |

Development

Setup

# Clone the repository
git clone https://github.com/pronskiy/redditify.git
cd redditify

# Install dependencies
npm install

# Start development server
npm run dev

Build

npm run build

Run Demo

# Run the demo server
npm run demo

Dependencies

Redditify has minimal dependencies:

  • date-fns - For date formatting

No framework dependencies (like React, Vue, or Angular) are required.

License

MIT