Skip to content
PluginStats

vite-plugin-html-inject weekly downloads statistics

By donnikitos · npm · Vite plugins

Split your index.html into multiple files and inject them where ever you want!

View on npm Fresh · Dec 6, 2026

vite-plugin-html-inject has 23,525 recorded weekly downloads on npm, an increase of 76.9% over the past 30 days, ranking #985 of 3,247 tracked listings.

Weekly downloads
23,525
Official API · Dec 5, 2026
7-day growth
+41.1%
+6.9K weekly downloads
30-day growth
+76.9%
+10.2K weekly downloads
90-day growth
+205%
+15.8K weekly downloads
Rank
#985
▲ 105 in 7 days

About vite-plugin-html-inject

vite-plugin-html-inject

npm GitHub Repo stars GitHub GitHub last commit Issues

Split your index.html into smaller, reusable static HTML pieces.

// vite.config.js
import { defineConfig } from 'vite';
import injectHTML from 'vite-plugin-html-inject';

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

Load those sweet separate HTML files

<!-- index.html -->
<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	</head>
	<body>
		<!-- Loads the specified .html file -->
		<load src="src/html/header/branding.html" />
		<!-- Loads index.html or index.htm file inside the specified directory -->
		<load src="src/html/header" />
		<div>
			<load src="src/html/body/sidebar.html" />
			<load src="src/html/body" />
		</div>
		<load src="src/html/footer" />
	</body>
</html>

Use environment variables in include paths

Include paths support Vite's %ENV_NAME% syntax, including built-in variables such as %MODE% and custom variables exposed with the VITE_ prefix (or your configured envPrefix).

<load src="src/html/%MODE%/header.html" />
<load src="src/html/%VITE_THEME%/footer.html" />

With MODE=development and VITE_THEME=dark, these load src/html/development/header.html and src/html/dark/footer.html.

Nest HTML includes

Included files can load other HTML files. Paths starting with ./ or ../ resolve relative to the file containing the <load> tag; other paths resolve from the Vite project root.

<!-- index.html -->
<load src="src/html/header.html" />
<!-- src/html/header.html -->
<header>
	<load src="./header/branding.html" />
	<load src="./%MODE%/navigation.html" />
</header>

Nested includes also support environment variables and static arguments.

Pass down static arguments to injected HTML parts

The plugin also allows you to supply your HTML parts with some basic arguments, so you can reuse the same piece of code in multiple places.

For example you can reuse a similarly styled link somewhere in your index.html:

<!-- index.html -->
...
<div class="some-cool-menu">
	<!-- Load a HTML part -->
	<load
		src="src/some-static-link.htm"
		label="Go to DuckDuckGo"
		href="https://duckduckgo.com/"
	/>
	<load
		src="src/some-static-link.htm"
		label="Go to Google"
		href="https://google.com"
	/>
</div>
...

And that src/some-static-link.htm:

<!-- src/some-static-link.htm -->
<a href="{=$href}" class="some-cool-link-style">{=$label}</a>

This will result in a dev and runtime generated index.html looking like

<!-- generated index.html -->
...
<div class="some-cool-menu">
	<!-- Load a HTML part -->
	<a href="https://duckduckgo.com/" class="some-cool-link-style">
		Go to DuckDuckGo
	</a>
	<a href="https://google.com" class="some-cool-link-style">Go to Google</a>
</div>
...

Customization

You are able to customize the loader tag name and the source attribute name.
For example a configuration like:

injectHTML({
	tagName: 'loader', // Default is `load`
	sourceAttr: 'file', // Default is `src`
});

will replace:

<!-- Load a HTML part -->
<loader
	file="src/some-static-link.htm"
	label="Go to DuckDuckGo"
	href="https://duckduckgo.com/"
/>

Debugging

By default the debugging option is turned off. However, if you encounter issues loading files, you can turn on path logging.

injectHTML({
	debug: {
		logPath: true,
	},
});

Support

Love open source? Enjoying my project?
Your support can keep the momentum going! Consider a donation to fuel the creation of more innovative open source software.

via Ko-FiBuy me a coffeevia PayPal
ko-fi<a href="https://www.buymeacoffee.com/donnikitos" target="_blank"><img src="https://nititech.de/donate-buymeacoffee.png" alt="Buy Me A Coffee" width="174"></a><a href="https://www.paypal.com/donate/?hosted_button_id=EPXZPRTR7JHDW" target="_blank"><img src="https://nititech.de/donate-paypal.png" alt="PayPal" width="174"></a>

Description from the npm listing.

  • vite
  • vite-plugin
  • load html
  • split html
  • inject html
  • html
  • html-loader
  • loader

README badge

Show your rank in a README or on your website. The badge updates automatically.

Charts

Images: 30d · 1y · all time · 1600×900 dark

Adoption over time

vite-plugin-html-inject weekly downloads on npm, last 90 days: 23,525 weekly downloads as of Dec 5, 2026, +205% over 90 days.vite-plugin-html-injectWeekly downloads on npm · Last 90 days23,525downloads / week+205% over 90 days05K10K15K20K25KSep 6Sep 21Oct 6Oct 21Nov 5Nov 20Dec 5downloads / weekobservedarchived (Internet Archive)no observationsSep 7, 2026 – Dec 5, 2026 · 90 observations · Updated Dec …pluginstats.com
vite-plugin-html-inject weekly downloads on npm, last 90 days: 23,525 weekly downloads as of Dec 5, 2026, +205% over 90 days.

7/30/90-day growth

vite-plugin-html-inject weekly downloads growth on npm: +41.1% over 7 days, +76.9% over 30 days, +205% over 90 days.vite-plugin-html-injectWeekly downloads growth on npm23,525downloads / week now7-day growth+6,851 weekly downloads+41.1%30-day growth+10,228 weekly downloads+76.9%90-day growth+15,820 weekly downloads+205%Growth vs. nearest observation to each baseline date · Updated Dec 5, 2026pluginstats.com
vite-plugin-html-inject weekly downloads growth on npm: +41.1% over 7 days, +76.9% over 30 days, +205% over 90 days.

Ranking history

vite-plugin-html-inject npm ranking history: currently #985 (by weekly downloads).vite-plugin-html-injectnpm ranking · by weekly downloads · Last 90 days#985current rank#400#600#800#1000#1200Sep 7Sep 22Oct 7Oct 22Nov 6Nov 21Dec 6rankOct 17, 2026 – Dec 6, 2026 · 45 observations · Updated Dec 5, 2026pluginstats.com
vite-plugin-html-inject npm ranking history: currently #985 (by weekly downloads).

Listing placement

All npm3,247 listings · 163 pages · 1,083 shown · page 50, #5 (overall #985)
All npm: every listing in weekly downloads order

Listing placement

Vite plugins300 listings · 15 pages · page 9, #12 (overall #172)
Vite plugins: every listing in weekly downloads order

Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.

Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.

Recent observations

Full history (591)
Recent weekly downloads observations for vite-plugin-html-inject
Date (UTC)Weekly downloadsChange vs. previous
23,525-126
23,651+4.5K
19,108+819
18,289+1.1K
17,234+670
16,564-391
16,955+281
16,674+1.6K
15,093+84
15,009+114
14,895-123
15,018+404
14,614+436
14,178—

Similar npm Vite plugins plugins

All 20 vite-plugin-html-inject alternatives

Data source

Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.

Listing: https://www.npmjs.com/package/vite-plugin-html-inject. First seen Oct 16, 2026; last successful collection Dec 6, 2026. See the methodology.