github.com/bketelsen/buffalo@v0.9.5/generators/newapp/templates/actions/render.go.tmpl (about)

     1  package actions
     2  
     3  import (
     4    {{ if .asWeb -}}
     5    "github.com/gobuffalo/packr"
     6    {{ end -}}
     7    "github.com/gobuffalo/buffalo/render"
     8  )
     9  
    10  var r *render.Engine
    11  {{ if .asWeb -}}
    12  var assetsBox = packr.NewBox("../public/assets")
    13  {{ end -}}
    14  
    15  func init() {
    16    r = render.New(render.Options{
    17      {{ if .asWeb -}}
    18        // HTML layout to be used for all HTML requests:
    19        HTMLLayout:     "application.html",
    20  
    21        // Box containing all of the templates:
    22        TemplatesBox: packr.NewBox("../templates"),
    23        AssetsBox:    assetsBox,
    24  
    25        // Add template helpers here:
    26        Helpers: render.Helpers{},
    27      {{ end -}}
    28    })
    29  }