all repos — vite @ fbcc6c93a3aa3282d34c7c90a223c9535e8d2b94

a fast (this time, actually) and minimal static site generator

config/config.go (view raw)

 1package config
 2
 3import (
 4	"os"
 5
 6	"gopkg.in/yaml.v3"
 7)
 8
 9type ConfigYaml struct {
10	Title  string `yaml:"title"`
11	Desc   string `yaml:"description"`
12	Author struct {
13		Name  string `yaml:"name"`
14		Email string `yaml:"email"`
15	} `yaml:"author"`
16	URL string `yaml:"url"`
17	//	Prebuild  []string `yaml:"prebuild"`
18	//	Postbuild []string `yaml:"postbuild"`
19}
20
21func (c *ConfigYaml) ParseConfig() error {
22	cf, err := os.ReadFile("config.yaml")
23	if err != nil {
24		return err
25	}
26	if err = yaml.Unmarshal(cf, c); err != nil {
27		return err
28	}
29	return nil
30}