Пример #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
// 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
func initTemplate(e *echo.Echo, templatePath string) {
	t := &Template{
		templates: template.Must(template.New("").Funcs(registerTemplateFunc()).ParseGlob(templatePath + "/*.html")),
	}
	e.SetRenderer(t)
}