1
goldsmith-samples/basic/main.go

35 lines
745 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{}
2019-02-01 15:40:18 +00:00
func (b *builder) Build(contentDir, buildDir, cacheDir string) {
errs := goldsmith.Begin(contentDir).
2019-02-02 02:46:23 +00:00
Cache(cacheDir).
2016-11-02 02:37:42 +00:00
Chain(frontmatter.New()).
2017-10-15 16:47:38 +00:00
Chain(markdown.New()).
2019-02-01 15:40:18 +00:00
Chain(layout.New()).
End(buildDir)
2016-11-02 02:37:42 +00:00
for _, err := range errs {
log.Print(err)
}
}
func main() {
2019-02-01 15:40:18 +00:00
port := flag.Int("port", 8080, "server port")
2018-01-08 21:35:02 +00:00
flag.Parse()
2019-02-01 15:40:18 +00:00
devserver.DevServe(new(builder), *port, "content", "build", "cache")
2016-11-02 02:37:42 +00:00
}