Renders HTML before Vite processes it and reloads pages when included templates change.
Vite does not evaluate Nunjucks expressions such as {{ siteName }} on
its own. Register this plugin with the locals needed by the HTML entry to
replace those expressions and load included template files during development
and production builds. It reads trusted templates from the filesystem and
uses Vite's watcher to reload the page when an included file changes.
Plain include names start from the HTML entry directory; ./ and ../ paths start
from the containing template's directory. Each HTML render uses a new Nunjucks
environment so templates from different entries cannot share loader state.
Includes and layouts are read asynchronously and registered with Vite's watcher,
including files outside the root. Requested paths are tracked regardless of
extension. Changes, deletion and recreation trigger a full client reload;
creating a previously requested missing include can recover a failed render.
Reloads refresh the whole page and do not preserve browser state.
Renders HTML before Vite processes it and reloads pages when included templates change.
Vite does not evaluate Nunjucks expressions such as {{ siteName }} on its own. Register this plugin with the locals needed by the HTML entry to replace those expressions and load included template files during development and production builds. It reads trusted templates from the filesystem and uses Vite's watcher to reload the page when an included file changes. Plain include names start from the HTML entry directory; ./ and ../ paths start from the containing template's directory. Each HTML render uses a new Nunjucks environment so templates from different entries cannot share loader state. Includes and layouts are read asynchronously and registered with Vite's watcher, including files outside the root. Requested paths are tracked regardless of extension. Changes, deletion and recreation trigger a full client reload; creating a previously requested missing include can recover a failed render. Reloads refresh the whole page and do not preserve browser state.