wip
This commit is contained in:
parent
e4acb8ee44
commit
1acd184562
@ -23,12 +23,15 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"flag"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/FooSoft/goldsmith"
|
"github.com/FooSoft/goldsmith"
|
||||||
"github.com/FooSoft/goldsmith-components/devserver"
|
"github.com/FooSoft/goldsmith-components/devserver"
|
||||||
|
"github.com/FooSoft/goldsmith-components/plugins/abs"
|
||||||
"github.com/FooSoft/goldsmith-components/plugins/breadcrumbs"
|
"github.com/FooSoft/goldsmith-components/plugins/breadcrumbs"
|
||||||
"github.com/FooSoft/goldsmith-components/plugins/collection"
|
"github.com/FooSoft/goldsmith-components/plugins/collection"
|
||||||
|
"github.com/FooSoft/goldsmith-components/plugins/condition"
|
||||||
"github.com/FooSoft/goldsmith-components/plugins/dom"
|
"github.com/FooSoft/goldsmith-components/plugins/dom"
|
||||||
"github.com/FooSoft/goldsmith-components/plugins/frontmatter"
|
"github.com/FooSoft/goldsmith-components/plugins/frontmatter"
|
||||||
"github.com/FooSoft/goldsmith-components/plugins/index"
|
"github.com/FooSoft/goldsmith-components/plugins/index"
|
||||||
@ -55,7 +58,9 @@ func fixup(doc *goquery.Document) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type builder struct{}
|
type builder struct {
|
||||||
|
root string
|
||||||
|
}
|
||||||
|
|
||||||
func (b *builder) Build(srcDir, dstDir string) {
|
func (b *builder) Build(srcDir, dstDir string) {
|
||||||
tagMeta := map[string]interface{}{
|
tagMeta := map[string]interface{}{
|
||||||
@ -80,6 +85,7 @@ func (b *builder) Build(srcDir, dstDir string) {
|
|||||||
Chain(syntax.New().Placement(syntax.PlaceInline)).
|
Chain(syntax.New().Placement(syntax.PlaceInline)).
|
||||||
Chain(dom.New(fixup)).
|
Chain(dom.New(fixup)).
|
||||||
Chain(thumbnail.New()).
|
Chain(thumbnail.New()).
|
||||||
|
Chain(condition.If(len(b.root) > 0, abs.New().BaseUrl(b.root))).
|
||||||
End(dstDir)
|
End(dstDir)
|
||||||
|
|
||||||
for _, err := range errs {
|
for _, err := range errs {
|
||||||
@ -88,5 +94,11 @@ func (b *builder) Build(srcDir, dstDir string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
devserver.DevServe(new(builder), 8080, "src", "dst", "layouts")
|
var (
|
||||||
|
root = flag.String("root", "", "root directory")
|
||||||
|
port = flag.Int("port", 8080, "server port")
|
||||||
|
)
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
|
devserver.DevServe(&builder{*root}, *port, "src", "dst", "layouts")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user