package
Version:
v0.0.0-...-a764074
Opens a new window with list of versions in this module.
Published: Jan 5, 2024
License: MIT
Opens a new window with license information.
Imports: 11
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
Prerequisities
- Go (latest)
Usage
- Import the package "github.com/muhhae/go-templ-htmx/pkg/watcher"
- Create WatchConfig struct with the following fields:
- Command - Command to run when a change is detected
- IncludeDirs - List of directory to watch for changes
- ExcludeDirs - List of directory to ignore
- Exclude - List of filename or file extension to ignore
- Include - List of filename or file extension to watch for changes
Example :
c := watcher.WatchConfig{
Command: []string{
"npx tailwindcss -i ./internal/style/style.css -o ./internal/static/style/output.css",
"templ generate",
"go run ./cmd/app/main.go",
},
IncludeDirs: []string{
".",
},
ExcludeDirs: []string{
"internal/static",
"node_modules",
".git",
".idea",
".vscode",
"vendor",
"cmd/watcher",
},
Exclude: []string{
"*_templ.go",
"*_test.go",
"*.git",
},
Include: []string{
"*.go",
"*.html",
"*.css",
"*.js",
"*.templ",
},
}
- Call c.Run()
- Execute the program "go run /path/to/main.go"
Documentation
¶
type WatchConfig struct {
Command []string `json:"command"`
IncludeDirs []string `json:"includeDirs"`
ExcludeDirs []string `json:"excludeDirs"`
Exclude []string `json:"exclude"`
Include []string `json:"include"`
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.