github.com/lenfree/buffalo@v0.7.3-0.20170207163156-891616ea4064/examples/html-resource/actions/render.go (about)

     1  package actions
     2  
     3  import (
     4  	"net/http"
     5  
     6  	rice "github.com/GeertJohan/go.rice"
     7  	"github.com/gobuffalo/buffalo/render"
     8  	"github.com/gobuffalo/buffalo/render/resolvers"
     9  )
    10  
    11  var r *render.Engine
    12  
    13  func init() {
    14  	r = render.New(render.Options{
    15  		HTMLLayout:     "application.html",
    16  		CacheTemplates: ENV == "production",
    17  		FileResolverFunc: func() resolvers.FileResolver {
    18  			return &resolvers.RiceBox{
    19  				Box: rice.MustFindBox("../templates"),
    20  			}
    21  		},
    22  	})
    23  }
    24  
    25  func assetsPath() http.FileSystem {
    26  	box := rice.MustFindBox("../assets")
    27  	return box.HTTPBox()
    28  }