<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sascha Seniuk</title>
    <description>The latest articles on DEV Community by Sascha Seniuk (@seniuk).</description>
    <link>https://dev.to/seniuk</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1933544%2F30250626-637a-4c1e-8678-a87fa26820ec.png</url>
      <title>DEV Community: Sascha Seniuk</title>
      <link>https://dev.to/seniuk</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/seniuk"/>
    <language>en</language>
    <item>
      <title>Make Your Vite Project LLM-Friendly with vite-plugin-llms</title>
      <dc:creator>Sascha Seniuk</dc:creator>
      <pubDate>Tue, 03 Dec 2024 12:08:29 +0000</pubDate>
      <link>https://dev.to/seniuk/make-your-vite-project-llm-friendly-with-vite-plugin-llms-4k3p</link>
      <guid>https://dev.to/seniuk/make-your-vite-project-llm-friendly-with-vite-plugin-llms-4k3p</guid>
      <description>&lt;p&gt;As Large Language Models (LLMs) become increasingly integrated into development workflows, there's growing interest in making our websites and documentation more accessible to these AI assistants. The llms.txt specification aims to address this need by providing a standardized way to serve LLM-friendly content. Today, I'm excited to introduce vite-plugin-llms, a Vite plugin that makes implementing the llms.txt specification a breeze.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is llms.txt?
&lt;/h2&gt;

&lt;p&gt;Before diving into the plugin, let's understand what llms.txt is. The specification suggests two main additions to your website:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A &lt;code&gt;/llms.txt&lt;/code&gt; file in your site's root that provides concise, markdown-formatted information about your project&lt;/li&gt;
&lt;li&gt;Clean markdown versions of your pages at the same URL with &lt;code&gt;.md&lt;/code&gt; appended&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This approach helps LLMs consume your content more effectively, which is particularly valuable when users interact with your site through AI-powered development tools or chat interfaces.&lt;/p&gt;

&lt;h2&gt;
  
  
  Introducing vite-plugin-llms
&lt;/h2&gt;

&lt;p&gt;The vite-plugin-llms plugin automates the process of serving these LLM-friendly versions of your content in Vite-based projects. Whether you're using Vue, React, Svelte, or any other framework that works with Vite, this plugin has you covered.&lt;/p&gt;

&lt;h3&gt;
  
  
  Key Features
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Automatically serves markdown files alongside your routes during development&lt;/li&gt;
&lt;li&gt;Handles the copying of llms.txt and markdown files to your build output&lt;/li&gt;
&lt;li&gt;Maintains your directory structure for markdown routes&lt;/li&gt;
&lt;li&gt;Provides clear logging of available markdown routes during both development and build&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Getting Started
&lt;/h3&gt;

&lt;p&gt;First, install the plugin:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;vite-plugin-llms &lt;span class="nt"&gt;--save-dev&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, add it to your Vite configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;defineConfig&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;vite&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;llms&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;vite-plugin-llms&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nf"&gt;defineConfig&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;plugins&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="nf"&gt;llms&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
      &lt;span class="na"&gt;llmsDir&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;llms&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="c1"&gt;// optional, defaults to 'llms'&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;
  &lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Project Structure
&lt;/h3&gt;

&lt;p&gt;The plugin expects a simple and intuitive project structure. Here's an example for a React project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;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
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Creating Your llms.txt
&lt;/h3&gt;

&lt;p&gt;Your llms.txt file should follow the specification's format. Here's a basic example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gh"&gt;# Your Project Name&lt;/span&gt;
&lt;span class="gt"&gt;
&amp;gt; A concise description of your project&lt;/span&gt;

&lt;span class="gu"&gt;## Documentation&lt;/span&gt;
&lt;span class="p"&gt;
-&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;Getting Started&lt;/span&gt;&lt;span class="p"&gt;](&lt;/span&gt;&lt;span class="sx"&gt;docs/getting-started.md&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;: Introduction to the project
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;API Reference&lt;/span&gt;&lt;span class="p"&gt;](&lt;/span&gt;&lt;span class="sx"&gt;docs/api.md&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;: Complete API documentation
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Why Use This Plugin?
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Future-Ready Development&lt;/strong&gt;: As AI tools become more integrated into development workflows, having LLM-friendly documentation will become increasingly important.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Automated Workflow&lt;/strong&gt;: Instead of manually managing markdown versions of your pages, the plugin handles the serving and building process automatically.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Framework Agnostic&lt;/strong&gt;: Works with any Vite-based project, giving you flexibility in your tech stack.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Zero Configuration Needed&lt;/strong&gt;: While configurable, the plugin works out of the box with sensible defaults.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Get Involved
&lt;/h2&gt;

&lt;p&gt;The plugin is open source and welcomes contributions! You can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Star the repository&lt;/li&gt;
&lt;li&gt;Report issues&lt;/li&gt;
&lt;li&gt;Suggest new features&lt;/li&gt;
&lt;li&gt;Submit pull requests&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The vite-plugin-llms plugin simplifies the process of making your Vite project LLM-friendly. By automating the implementation of the llms.txt specification, it helps prepare your project for a future where AI assistants are an integral part of the development workflow.&lt;/p&gt;

&lt;p&gt;Give it a try in your next Vite project and let me know how it works for you in the comments below!&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Links and Resources:&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/saschaseniuk/vite-plugin-llms" rel="noopener noreferrer"&gt;vite-plugin-llms on GitHub&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://llmstxt.org" rel="noopener noreferrer"&gt;llms.txt Specification&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://vitejs.dev" rel="noopener noreferrer"&gt;Vite Documentation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>llm</category>
      <category>vite</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
