1//go:build ignore
 2
 3package main
 4
 5import (
 6	"fmt"
 7	"log"
 8	"net/http"
 9	"os"
10	"path/filepath"
11
12	"github.com/shurcooL/httpfs/filter"
13	"github.com/shurcooL/vfsgen"
14)
15
16func main() {
17	var cwd, _ = os.Getwd()
18
19	webUIAssets := filter.Skip(
20		http.Dir(filepath.Join(cwd, "webui/build")),
21		func(path string, fi os.FileInfo) bool {
22			return filter.FilesWithExtensions(".map")(path, fi)
23		},
24	)
25
26	fmt.Println("Packing Web UI files ...")
27
28	err := vfsgen.Generate(webUIAssets, vfsgen.Options{
29		Filename:     "webui/packed_assets.go",
30		PackageName:  "webui",
31		BuildTags:    "!debugwebui",
32		VariableName: "WebUIAssets",
33	})
34
35	if err != nil {
36		log.Fatalln(err)
37	}
38}