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

vite-plugin-minisite

v0.0.0

Published

Vite plugin that compiles a folder of Markdown files plus optional assets into a single self-contained minisite (single index.html with hash routing)

Readme

vite-plugin-minisite

A Vite plugin that compiles a folder of Markdown files (plus optionally embedded assets) into a single, self-contained index.html – with hash routing and embedded Markdown CSS. No external server, no build steps when shipping.

This is the successor of the sam-cli minisite command from samengine-cli, now as a real Vite plugin in TypeScript.

Features

  • 📄 Markdown pages from pages/ (nesting allowed, index.md = home page)
  • 🏷 Hash routing (#/sub/route), optional 404 page via pages/404.md
  • 🎨 Embedded Markdown CSS (minified)
  • 🖼 Assets (images, videos, PDFs, text files, …) embedded directly into the page as base64 data URIs – 100 % offline/standalone
  • 🛠 Vite dev server + watch: changes to .md files trigger recompilation
  • 📦 Build: writes the finished index.html into the outDir

Installation

npm install --save-dev vite-plugin-minisite

Usage

vite.config.ts:

import { defineConfig } from "vite";
import { minisite } from "vite-plugin-minisite";

export default defineConfig({
  plugins: [
    minisite({
      // Options (all optional)
      pagesDir: "pages", // Markdown folder
      assets: [
        // embedded files
        { file: "assets/logo.png", type: "image/png", slug: "logo" },
      ],
    }),
  ],
});

Project structure

├── vite.config.ts
├── pages/
│   ├── index.md          → Route "#/" (home page)
│   ├── 404.md            → Route "#/404" (fallback)
│   ├── about.md          → Route "#/about"
│   └── docs/
│       └── guide.md      → Route "#/docs/guide"
└── assets/
    └── logo.png

After vite build, a complete page is written to dist/index.html – just drop it on any static host (or double-click it locally).

Options

| Option | Type | Default | Description | | ---------- | -------------------------------------------------- | ----------------------------------------- | ------------------------------------------------------------------ | | pagesDir | string | "pages" | Folder containing the Markdown files | | template | string | (built-in) | Custom HTML template file (must contain __PAGES__ and __CSS__) | | markdown | { externalLinks, breaks, smartypants, sanitize } | { externalLinks: true, sanitize: true } | Markdown parser options | | assets | MiniSiteAsset[] | [] | Embedded assets ({ file, type, slug }) | | outFile | string | "index.html" | File name in the outDir | | mounts | string[] | [] | Additional mount paths for virtual modules (advanced) |

Assets

minisite({
  assets: [
    { file: "assets/logo.png", type: "image/png", slug: "logo" },
    { file: "assets/demo.mp4", type: "video/mp4", slug: "video" },
    { file: "docs/handbuch.pdf", type: "application/pdf", slug: "pdf" },
    { file: "assets/readme.txt", type: "text/plain", slug: "text" },
  ],
});

Each asset is reachable under #/___assets___/<slug>.

Template

Default template (bundled). If template.html exists in the project root, it takes precedence. It must contain these placeholders:

<style>
/*__CSS__{}*/        <!-- Markdown CSS is injected here -->
</style>
...
<script>
const pages = __PAGES__;   <!-- Pages table is injected here -->
...

Programmatic API

In addition to the plugin integration, you can use the compilation directly:

import { minisite, compilePages, renderHtml } from "vite-plugin-minisite";

// Option A: via the plugin
const plugin = minisite({ pagesDir: "pages" });
// ...add the plugin to the Vite config, then:
const html = plugin.render(); // after configResolved

// Option B: directly
const pages = compilePages("pages", process.cwd(), [], { sanitize: true });
fs.writeFileSync("index.html", renderHtml(pages, templateHtml));

License

MIT