Esempio n. 1
0
func serveStatic(e *echo.Echo) {
	for prefix, rootConf := range staticFileMap {
		filterPrefixs = append(filterPrefixs, prefix)

		if rootConf.isFile {
			e.File(prefix, ROOT+rootConf.root)
		} else {
			e.Static(prefix, ROOT+rootConf.root)
		}
	}
}
Esempio n. 2
0
File: theme.go Progetto: 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)
}