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

     1  package actions
     2  
     3  import (
     4    {{ if .opts.AsWeb -}}
     5    "github.com/gobuffalo/packr"
     6    {{ end -}}
     7    "github.com/gobuffalo/buffalo/render"
     8  )
     9  
    10  var r *render.Engine
    11  {{ if .opts.AsWeb -}}
    12  var assetsBox = packr.NewBox("../public")
    13  {{ end -}}
    14  
    15  func init() {
    16    r = render.New(render.Options{
    17      {{ if .opts.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        // uncomment for non-Bootstrap form helpers:
    28        // "form":     plush.FormHelper,
    29        // "form_for": plush.FormForHelper,
    30        },
    31      {{ end -}}
    32    })
    33  }