bou.ke/statictemplate@v0.0.0-20180821122055-510411a5e7dd/README.md (about)

     1  # statictemplate
     2  
     3  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.
     4  
     5  Please read [my blogpost](http://bouk.co/blog/code-generating-code/) about this project for some background.
     6  
     7  ## Installation
     8  
     9  To install the commandline tool, run `go get bou.ke/statictemplate`.
    10  
    11  ## Usage
    12  
    13  These are the supported flags:
    14  
    15  ```
    16  Usage of statictemplate:
    17    -dev string
    18          Name of the dev output file
    19    -funcs string
    20          A reference to a custom Funcs map to include
    21    -html
    22          Interpret templates as HTML, to enable Go's automatic HTML escaping
    23    -o string
    24          Name of the output file (default "template.go")
    25    -package string
    26          Name of the package of the result file. Defaults to name of the folder of the output file
    27    -t value
    28          Target to process, supports multiple. The format is <function name>:<template name>:<type of the template argument>
    29  ```
    30  
    31  After the flags you pass in one or more globs to specify the templates.
    32  
    33  
    34  The example in this project uses the following command
    35  
    36  ```
    37  statictemplate -html -o example/template/template.go -t "Index:index.tmpl:[]bou.ke/statictemplate/example.Post" example/template/*.tmpl
    38  ```
    39  
    40  ## Docs
    41  
    42  [Check out the docs](https://godoc.org/bou.ke/statictemplate/statictemplate).