mirror of
https://github.com/kataras/iris.git
synced 2025-01-24 19:21:03 +01:00
25 lines
656 B
Go
25 lines
656 B
Go
package jade
|
|
|
|
import (
|
|
"github.com/Joker/jade"
|
|
"github.com/kataras/iris/config"
|
|
"github.com/kataras/iris/render/template/engine/html"
|
|
)
|
|
|
|
// Engine the JadeEngine
|
|
type Engine struct {
|
|
*html.Engine
|
|
}
|
|
|
|
// New creates and returns a new JadeEngine with its configs
|
|
func New(cfg config.Template) *Engine {
|
|
cfg.HTMLTemplate.Funcs = cfg.Jade.Funcs //copy the jade's funcs to the underline HTMLEngine
|
|
cfg.HTMLTemplate.LayoutFuncs = cfg.Jade.LayoutFuncs
|
|
underline := &Engine{Engine: html.New(cfg)}
|
|
underline.Middleware = func(relativeName string, fileContents string) (string, error) {
|
|
return jade.Parse(relativeName, fileContents)
|
|
}
|
|
|
|
return underline
|
|
}
|