Typical project layout using vite-plugin-html-elements.
project/
├── public/
│ ├── favicon.ico
│ └── logo.webp
├── src/
│ ├── elements/
│ │ ├── head.html
│ │ ├── header.html
│ │ └── footer.html
│ ├── index.html
│ ├── docs.html
│ ├── examples.html
│ └── styles.css
├── package.json
├── pnpm-lock.yaml
└── vite.config.js
<!doctype html>
<html>
<element src="head.html" />
<body>
<element src="header.html" />
<main>Page content</main>
<element src="footer.html" />
</body>
</html>
Create reusable UI components for consistent design.
<div class="bg-white dark:bg-secondary-800 rounded-lg p-6 shadow-md">
<div class="text-primary-400 text-3xl mb-3">{{icon}}</div>
<h3 class="text-xl font-semibold mb-2">{{title}}</h3>
<slot />
</div>
<element src="card.html" icon="⚡" title="Fast Builds">
<p class="text-secondary-600 dark:text-secondary-300">
Lightning-fast hot reloading during development.
</p>
</element>
<element src="card.html" icon="🎨" title="Style Freedom">
<p class="text-secondary-600 dark:text-secondary-300">
Works with Tailwind, plain CSS, or any framework.
</p>
</element>
<element src="card.html" icon="📦" title="Zero Config">
<p class="text-secondary-600 dark:text-secondary-300">
Works out of the box with sensible defaults.
</p>
</element>
See what happens at build time - element tags are replaced with actual HTML.
<!doctype html>
<html>
<body>
<element src="header.html" />
<main>Your content</main>
</body>
</html>
<!doctype html>
<html>
<body>
<header class="bg-primary-600 p-4">
<nav class="flex justify-between">
<a href="/">Home</a>
<a href="/docs">Docs</a>
</nav>
</header>
<main>Your content</main>
</body>
</html>
No runtime JavaScript required. The final HTML is completely static.
Pass dynamic content into reusable components using slots and props.
<div class="bg-secondary-800 rounded-lg p-6">
<h3 class="text-xl font-semibold text-white mb-2">{{title}}</h3>
<slot />
</div>
<element src="card.html" title="Fast Builds">
<p>Lightning-fast hot reloading during development.</p>
</element>
<element src="card.html" title="Zero Config">
<p>Works out of the box with sensible defaults.</p>
</element>
Reuse headers, footers, and call-to-action sections across marketing pages.
Share navigation, sidebars, and footer content across all doc pages.
Maintain consistent layout and structure across all blog posts.
Keep all pages in sync without a JavaScript framework.
Check out the Git repository for more examples and real-world use cases.
View on Codeberg →