예제 #1
0
func InitializeRenderers(e *echo.Echo) error {
	//e.Use(middleware.Logger())
	e.Use(middleware.Recover())
	e.SetRenderer(&EchoRenderer{})

	e.GET("/static*", RenderStatic)

	return nil
}
예제 #2
0
파일: theme.go 프로젝트: mewben/onix
// Setup theme
func Setup(e *echo.Echo, mode string) {
	var t Template
	if mode == "dev" {
		// development
		t.templates = template.Must(template.ParseGlob("internals/themes/" + Theme + "/*.html"))

		e.Static("/assets", "internals/themes/"+Theme+"/assets")
		e.File("/favicon.ico", "internals/themes/"+Theme+"favicon.ico")
	} else {
		// production
		t.templates = template.Must(template.ParseGlob("public/themes/" + Theme + "/*.html"))

		e.Static("/assets", "public/themes/"+Theme+"/assets")
		e.File("/favicon.ico", "public/themes/"+Theme+"favicon.ico")
	}

	e.SetRenderer(&t)
}
예제 #3
0
func Set(e *echo.Echo, routes []string) *echo.Echo {
	e.SetRenderer(templates("view", routes))

	return e
}
예제 #4
0
파일: template.go 프로젝트: schaffers/typed
func initTemplate(e *echo.Echo, templatePath string) {
	t := &Template{
		templates: template.Must(template.New("").Funcs(registerTemplateFunc()).ParseGlob(templatePath + "/*.html")),
	}
	e.SetRenderer(t)
}