1.0.2 • Published 2 years ago

vite-plugin-stachtml v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Vite plugin StachTML

StachTML is a vite plugin to add stach templating into loaded HTML files.

vite.config.js

import { resolve } from "path"
import { stachtml } from "vite-plugin-stachtml"
export default defineConfig( viteConfig => {
	return {
		build: {
			rollupOptions: {
				input: [ resolve('src/index.html') ]
			},
			outDir: resolve('dist'),
		},
		plugins: {
			stachtml({
				pageTitle: "Page title",
				mainTitle: "Hello from stachTML",
			})
		}
	}
})

src/index.html

<html>
	<head>
		<title>{{ pageTitle }}</title>
	</head>
	<body>
		<h1>{{ mainTitle }}</h1>
        <p>{{ MY_DOT_ENV_VALUE }}</p>
	</body>
</html>

.env

Dot envs are also available as template vars. Please check that your env is correctly loaded with vite requirements.

MY_DOT_ENV_VALUE=Value from dot env
1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago