FAQ
Hello to everyone,

I released a package called "wutrender" here: github.com/8protons/wutrender

No magic at all, just plain Go templates. It reads all files from a
directory (default to "templates") creating templates with names in format
"path/name.{format}", where "{format}" is a file content type like "html",
"js", "json" (idea from Ruby on Rails).
For example, "templates/sessions/new.html.tmpl" => "sessions/new.html".

Then we can render the templates with a variety of functions:
wutrender.HTML, wutrender.JS, wutrender.RenderFormat("html", ...) - all
this functions return (*bytes.Buffer, error). Also, there are functions
like wutrender.WriteHTML or wutrender.WriteJS which take
http.ResponseWriter as the first argument and write to it.

It also uses application environment approach (by GO_ENV=production
variable) - in dev mode it recompiles all templates and in production mode
it uses .Clone() function of html/template package.

Support layout with special function {{ yield }} and partials with
bindings: {{ partial "path" }} (empty) or {{ partial "path" . }} (all
parent binding) or {{ partial "path" "user" .User "isEdit" true }}
(key-value).

Feel free to contact me if you have any questions or suggestions and
please, use github issues for... issues only, all discussions go here.

Cheers.

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedSep 2, '14 at 4:25p
activeSep 2, '14 at 4:25p
posts1
users1
websitegolang.org

1 user in discussion

Anton Sekatski: 1 post

People

Translate

site design / logo © 2021 Grokbase