1package css
2
3import (
4 "embed"
5 "html/template"
6 "os"
7)
8
9//go:embed tmpl
10var templates embed.FS
11
12func Create(path string) error {
13 const name = "base.tmpl"
14 stylesheet := template.New(name)
15
16 t, err := stylesheet.ParseFS(templates, "tmpl/*.tmpl")
17 if err != nil {
18 return err
19 }
20
21 file, err := os.Create(path)
22 if err != nil {
23 return err
24 }
25 defer file.Close()
26
27 err = t.Execute(file, nil)
28 if err != nil {
29 return err
30 }
31
32 return nil
33}