Documentation
¶
Overview ¶
Package view provides Vite backend integration for fiber.
It generates the correct <script>/<link> tags for the HTML <head> section without serving index.html itself — the Go server owns the HTML shell.
Dev mode: tags point to the Vite dev server (HMR + hot reload). Prod mode: tags use content-hashed filenames read from dist/.vite/manifest.json.
Vite backend integration reference: https://vite.dev/guide/backend-integration.html
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type View ¶
type View struct {
// contains filtered or unexported fields
}
View wraps olivere/vite.Fragment and exposes fiber-friendly helpers.
func New ¶
New builds a View. isDev comes from AppConfig.IsDev().
- Dev: generates @vite/client + entry script tags for the Vite dev server.
- Prod: reads dist/.vite/manifest.json and generates hashed asset tags.
func (*View) IndexHandler ¶
IndexHandler serves the SPA shell page for every unmatched route.
app.Get("/*", viteView.IndexHandler)
Click to show internal directories.
Click to hide internal directories.