Skip to content

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vite-plugin-include

Vite plugin to inline HTML partials recursively with <include src="..." />.

Config

import { defineConfig } from "vite";
import includeHtml from "vite-plugin-include";

export default defineConfig({
  plugins: [includeHtml()],
});

Usage

<!-- Relative to current file -->
<include src="header.html" />
<include src="./partials/nav.html"></include>

<!-- Relative to vite project root -->
<include src="/partials/footer.html" />

Features

  • Recursive includes are supported, so you can include files that themselves include other files.
  • Relative paths and absolute paths are supported (absolute point to vite project root).
  • Simple, short and lightweight, with no dependencies.

License

Licensed under the MIT License.

About

Vite plugin that replaces deleted vite-include-html-plugin npm module

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Packages

Contributors

Languages