https://github.com/saschaseniuk/vite-plugin-llms
A Vite plugin that implements the llms.txt specification, enabling AI-optimized content alongside your routes. It automatically serves markdown files for LLM consumption and handles the llms.txt routing in development and production.
https://github.com/saschaseniuk/vite-plugin-llms
Last synced: about 2 months ago
JSON representation
A Vite plugin that implements the llms.txt specification, enabling AI-optimized content alongside your routes. It automatically serves markdown files for LLM consumption and handles the llms.txt routing in development and production.
- Host: GitHub
- URL: https://github.com/saschaseniuk/vite-plugin-llms
- Owner: saschaseniuk
- License: mit
- Created: 2024-12-03T09:39:39.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-12-03T11:03:27.000Z (11 months ago)
- Last Synced: 2025-08-27T00:55:36.669Z (2 months ago)
- Language: TypeScript
- Homepage:
- Size: 29.3 KB
- Stars: 28
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome - saschaseniuk/vite-plugin-llms - A Vite plugin that implements the llms.txt specification, enabling AI-optimized content alongside your routes. It automatically serves markdown files for LLM consumption and handles the llms.txt routing in development and production. (TypeScript)
- fucking-awesome-vite - vite-plugin-llms - Integration for the llms.txt specification supporting AI optimized content alongside application routes. (Plugins / Framework-agnostic Plugins)
- awesome-vite - vite-plugin-llms - Integration for the llms.txt specification supporting AI optimized content alongside application routes. (Plugins / Framework-agnostic Plugins)
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](https://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
```bash
npm install vite-plugin-llms --save-dev
```
## Usage
1. Add the plugin to your `vite.config.js` or `vite.config.ts`:
```javascript
import { defineConfig } from 'vite'
import llms from 'vite-plugin-llms'
export default defineConfig({
plugins: [
llms({
llmsDir: 'llms' // optional, defaults to 'llms'
})
]
})
```
2. Create a `llms` directory in your project root and add your `llms.txt` file:
```markdown
# Project Name
> Project description goes here
## Documentation
- [Getting Started](docs/getting-started.md): Introduction to the project
```
3. 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