Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var HtmlPlugin = api.Plugin{ Name: "html-plugin", Setup: func(build api.PluginBuild) { build.OnEnd(func(result *api.BuildResult) (api.OnEndResult, error) { var entryContent string for _, output := range result.OutputFiles { if strings.Contains(output.Path, "index") { scriptPath := filepath.Base(output.Path) if strings.HasSuffix(output.Path, ".js") { htmlScript := `<script type="module" src="/static/` + scriptPath + `"></script>` entryContent += htmlScript + "\n" } if strings.HasSuffix(output.Path, ".css") { htmlCss := `<link rel="stylesheet" href="/static/` + scriptPath + `">` entryContent += htmlCss + "\n" } } } wrappedContent := `{{define "entry"}}` + "\n" + entryContent + `{{end}}` err := os.WriteFile(filepath.Join("templates", "entry.html"), []byte(wrappedContent), 0644) if err != nil { return api.OnEndResult{}, err } fmt.Println("wrote entry.twig in ./templates") return api.OnEndResult{}, nil }) }, }
HtmlPlugin is an exported variable for the HTML plugin
View Source
var RebuildPlugin = api.Plugin{ Name: "rebuild-plugin", Setup: func(build api.PluginBuild) { build.OnEnd(func(result *api.BuildResult) (api.OnEndResult, error) { events.EmitEvent("esbuild", map[string]bool{"done": true}) fmt.Println("emitted esbuild event") return api.OnEndResult{}, nil }) }, }
HtmlPlugin is an exported variable for the HTML plugin
Functions ¶
func Build ¶
func Build(options api.BuildOptions) api.BuildResult
func InitDevMode ¶
func InitDevMode(options api.BuildOptions) api.BuildContext
Types ¶
type Options ¶
type Options struct {
api.BuildOptions
}
Click to show internal directories.
Click to hide internal directories.