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

vite-plugin-llms

v1.0.2

Published

Vite plugin for llms.txt specification support

Downloads

172

Readme

vite-plugin-llms

A framework-agnostic Vite plugin to support the llms.txt specification.

Background

The llms.txt specification aims to provide information in a more concise form for Large Language Models (LLMs). While websites primarily serve human readers, they are increasingly accessed by LLMs through AI helpers and development environments.

The specification suggests adding a /llms.txt file to your site and providing clean markdown versions of your pages at the same URL with .md appended.

For more information visit: llmstxt.org

Features

  • Serves markdown files alongside your routes in development
  • Copies llms.txt and markdown files to build output
  • Preserves directory structure for markdown routes
  • Logs available markdown routes during development and build
  • Works with any Vite-based framework (Vue, React, Svelte, Astro, etc.)

Installation

npm install vite-plugin-llms --save-dev

Usage

  1. Add the plugin to your vite.config.js or vite.config.ts:
import { defineConfig } from 'vite'
import llms from 'vite-plugin-llms'

export default defineConfig({
  plugins: [
    llms({
      llmsDir: 'llms' // optional, defaults to 'llms'
    })
  ]
})
  1. Create a llms directory in your project root and add your llms.txt file:
# Project Name

> Project description goes here

## Documentation

- [Getting Started](docs/getting-started.md): Introduction to the project
  1. Add markdown files corresponding to your routes. Examples for different frameworks:
# Vue
your-project/
├── src/
│   └── views/
│       ├── AboutView.vue      # route: /about
│       └── DocsView.vue       # route: /docs
├── llms/
│   ├── llms.txt
│   ├── about.md              # accessible via: /about.md
│   └── docs.md               # accessible via: /docs.md
└── vite.config.js

# React
your-project/
├── src/
│   └── pages/
│       ├── About.tsx         # route: /about
│       └── Docs.tsx          # route: /docs
├── llms/
│   ├── llms.txt
│   ├── about.md             # accessible via: /about.md
│   └── docs.md              # accessible via: /docs.md
└── vite.config.js

# Astro
your-project/
├── src/
│   └── pages/
│       ├── about.astro      # route: /about
│       └── docs.astro       # route: /docs
├── llms/
│   ├── llms.txt
│   ├── about.md            # accessible via: /about.md
│   └── docs.md             # accessible via: /docs.md
└── vite.config.js

Development

During development, the plugin will:

  • Make markdown files available at your-route.md
  • Log all available markdown routes on server start

Production

In production builds, the plugin will:

  • Copy llms.txt to your build output
  • Copy all markdown files with preserved directory structure
  • Log all copied files for verification

License

MIT