statictemplate

Statictemplate is a code generator for Go's text/template and html/template.

  • 所有者: bouk/statictemplate
  • 平台:
  • 许可证: MIT License
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

statictemplate

Statictemplate is a code generator for Go's text/template and html/template packages. It works by reading in the template files, and generating the needed functions based on the combination of requested function names and type signatures.

Please read my blogpost about this project for some background.

Installation

To install the commandline tool, run go get bou.ke/statictemplate.

Usage

These are the supported flags:

Usage of statictemplate:
  -dev string
        Name of the dev output file
  -funcs string
        A reference to a custom Funcs map to include
  -html
        Interpret templates as HTML, to enable Go's automatic HTML escaping
  -o string
        Name of the output file (default "template.go")
  -package string
        Name of the package of the result file. Defaults to name of the folder of the output file
  -t value
        Target to process, supports multiple. The format is <function name>:<template name>:<type of the template argument>

After the flags you pass in one or more globs to specify the templates.

The example in this project uses the following command

statictemplate -html -o example/template/template.go -t "Index:index.tmpl:[]bou.ke/statictemplate/example.Post" example/template/*.tmpl

Docs

Check out the docs.

主要指标

概览
名称与所有者bouk/statictemplate
主编程语言Go
编程语言Go (语言数: 3)
平台
许可证MIT License
所有者活动
创建于2016-09-02 17:16:37
推送于2018-08-21 12:20:56
最后一次提交2018-08-21 14:20:55
发布数0
用户参与
星数80
关注者数1
派生数5
提交数36
已启用问题?
问题数4
打开的问题数3
拉请求数2
打开的拉请求数0
关闭的拉请求数0
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?