gorice

package
v0.0.0-...-9637776 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2019 License: MIT Imports: 2 Imported by: 0

README

Basic

Support template for go.rice

Install

go get github.com/foolin/echo-template/supports/gorice

Useage

 echo.Renderer = gorice.New(rice.MustFindBox("views"))

Example


func main() {

	// Echo instance
	e := echo.New()

	// servers other static files
	staticBox := rice.MustFindBox("static")
	staticFileServer := http.StripPrefix("/static/", http.FileServer(staticBox.HTTPBox()))
	e.GET("/static/*", echo.WrapHandler(staticFileServer))

	//Set Renderer
	e.Renderer = gorice.New(rice.MustFindBox("views"))

	// Start server
	e.Logger.Fatal(e.Start(":9090"))
}

gorice example

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileHandler

func FileHandler(viewsRootBox *rice.Box) echotemplate.FileHandler

func New

func New(viewsRootBox *rice.Box) *echotemplate.TemplateEngine

* New echo template engine, default views root.

func NewWithConfig

func NewWithConfig(viewsRootBox *rice.Box, config echotemplate.TemplateConfig) *echotemplate.TemplateEngine

* New echo template engine Important!!! The viewsRootBox's name and config.Root must be consistent.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL