1
goldsmith-samples/basic/main.go

36 lines
784 B
Go
Raw Normal View History

2016-11-02 02:37:42 +00:00
package main
import (
2018-01-08 21:35:02 +00:00
"flag"
2016-11-02 02:37:42 +00:00
"log"
"github.com/FooSoft/goldsmith"
2018-01-08 17:24:26 +00:00
"github.com/FooSoft/goldsmith-components/devserver"
"github.com/FooSoft/goldsmith-components/plugins/frontmatter"
"github.com/FooSoft/goldsmith-components/plugins/layout"
"github.com/FooSoft/goldsmith-components/plugins/markdown"
2016-11-02 02:37:42 +00:00
)
type builder struct{}
func (b *builder) Build(srcDir, dstDir string) {
errs := goldsmith.Begin(srcDir).
Chain(frontmatter.New()).
2017-10-15 16:47:38 +00:00
Chain(markdown.New()).
2016-11-02 02:37:42 +00:00
Chain(layout.New("layouts/*.html")).
End(dstDir)
for _, err := range errs {
log.Print(err)
}
}
func main() {
2018-01-09 02:08:50 +00:00
var (
dst = flag.String("dst", "dst", "destination directory")
port = flag.Int("port", 8080, "server port")
)
2018-01-08 21:35:02 +00:00
flag.Parse()
2018-01-09 02:08:50 +00:00
devserver.DevServe(new(builder), *port, "src", *dst, "layouts")
2016-11-02 02:37:42 +00:00
}