Provides Twig-compatibility for the stick templating engine.
This is the Twig compatibility subpackage for Stick.
Package
github.com/tyler-sommer/stick/twig
contains extensions to provide the most Twig-like experience for
template writers. It aims to feature the same functions, filters, etc.
to be closely Twig-compatible.
Package
github.com/tyler-sommer/stick
is a Twig template parser and executor. It provides the core
functionality and offers many of the same extension points as Twig like
functions, filters, node visitors, etc.
The twig
package is intended to be used as a library. The recommended
way to install the library is using go get
.
go get -u github.com/tyler-sommer/stick/twig
Execute a simple Twig template.
package main
import (
"log"
"os"
"github.com/tyler-sommer/stick"
"github.com/tyler-sommer/stick/twig"
)
func main() {
env := twig.New(nil)
if err := env.Execute("Hello, {{ name }}!", os.Stdout, map[string]stick.Value{"name": "Tyler"}); err != nil {
log.Fatal(err)
}
}