Debian Codegraph @

lib/assets/generate/main.go

raw
1 // Package main ...
2 package main
3
4 import (
5 "path/filepath"
6
7 "github.com/go-rod/rod/lib/utils"
8 )
9
10 var slash = filepath.FromSlash
11
12 func main() {
13 build := utils.S(`// Package assets is generated by "lib/assets/generate"
14 package assets
15
16 // MousePointer for rod
17 const MousePointer = {{.mousePointer}}
18
19 // Monitor for rod
20 const Monitor = {{.monitor}}
21
22 // MonitorPage for rod
23 const MonitorPage = {{.monitorPage}}
24 `,
25 "mousePointer", get("../../fixtures/mouse-pointer.svg"),
26 "monitor", get("monitor.html"),
27 "monitorPage", get("monitor-page.html"),
28 )
29
30 utils.E(utils.OutputFile(slash("lib/assets/assets.go"), build))
31 }
32
33 func get(path string) string {
34 code, err := utils.ReadString(slash("lib/assets/" + path))
35 utils.E(err)
36 return utils.EscapeGoString(code)
37 }