watcher

package
v0.0.0-...-a764074 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 5, 2024 License: MIT Imports: 11 Imported by: 0

README

Prerequisities

  1. Go (latest)

Usage

  1. Import the package "github.com/muhhae/go-templ-htmx/pkg/watcher"
  2. 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",
    	},
    }
    
  3. Call c.Run()
  4. Execute the program "go run /path/to/main.go"

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WatchConfig

type WatchConfig struct {
	Command     []string `json:"command"`
	IncludeDirs []string `json:"includeDirs"`
	ExcludeDirs []string `json:"excludeDirs"`
	Exclude     []string `json:"exclude"`
	Include     []string `json:"include"`
}

func (WatchConfig) Run

func (c WatchConfig) Run()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL