feat: add custom Datastar.js configuration support
Allow users to provide their own Datastar.js script (e.g., Datastar Pro or custom builds) via Via's Options configuration. Adds DatastarConfig struct with Content ([]byte) and Path (string) fields.
This commit is contained in:
@@ -2,6 +2,17 @@ package via
|
||||
|
||||
import "github.com/alexedwards/scs/v2"
|
||||
|
||||
// DatastarConfig configures a custom Datastar.js script.
|
||||
type DatastarConfig struct {
|
||||
// Content is the Datastar.js script content.
|
||||
// If nil, the embedded default is used.
|
||||
Content []byte
|
||||
|
||||
// Path is the URL path where the script is served.
|
||||
// Defaults to "/_datastar.js" if empty.
|
||||
Path string
|
||||
}
|
||||
|
||||
type LogLevel int
|
||||
|
||||
const (
|
||||
@@ -37,4 +48,8 @@ type Options struct {
|
||||
// with scs LoadAndSave middleware. Configure the session manager before
|
||||
// passing it (lifetime, cookie settings, store, etc).
|
||||
SessionManager *scs.SessionManager
|
||||
|
||||
// Datastar configures a custom Datastar.js script.
|
||||
// If nil, Via uses its embedded default.
|
||||
Datastar *DatastarConfig
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user