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?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?