package main import ( "flag" "log" "git.foosoft.net/alex/goldsmith" "git.foosoft.net/alex/goldsmith/devserver" "git.foosoft.net/alex/goldsmith/filters/condition" "git.foosoft.net/alex/goldsmith/plugins/frontmatter" "git.foosoft.net/alex/goldsmith/plugins/layout" "git.foosoft.net/alex/goldsmith/plugins/markdown" "git.foosoft.net/alex/goldsmith/plugins/minify" ) type builder struct { dist bool } func (self *builder) Build(srcDir, dstDir, cacheDir string) { var gs goldsmith.Goldsmith errs := gs.Begin(srcDir). Chain(frontmatter.New()). Chain(markdown.New()). Chain(layout.New()). FilterPush(condition.New(self.dist)). Chain(minify.New()). FilterPop(). End(dstDir) for _, err := range errs { log.Print(err) } } func main() { port := flag.Int("port", 8080, "server port") dist := flag.Bool("dist", false, "final dist mode") flag.Parse() devserver.DevServe(&builder{*dist}, *port, "content", "build", "cache") }