gorice

package
v0.0.0-...-41efedf Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2019 License: MIT Imports: 2 Imported by: 10

README

Basic

Support template for go.rice

Install

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

Useage

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

Example


func main() {

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

	// servers other static files
	staticBox := rice.MustFindBox("static")
	staticFileServer := http.StripPrefix("/static/", http.FileServer(staticBox.HTTPBox()))
	e.GET("/static/*", gin.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) gintemplate.FileHandler

*

Support go.rice file handler

func New

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

* New gin template engine, default views root.

func NewWithConfig

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

* New gin 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