https://github.com/jackc/gel
Go Compiled Templates
https://github.com/jackc/gel
Last synced: about 2 months ago
JSON representation
Go Compiled Templates
- Host: GitHub
- URL: https://github.com/jackc/gel
- Owner: jackc
- License: mit
- Created: 2013-05-03T13:23:06.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2019-07-27T22:43:48.000Z (almost 6 years ago)
- Last Synced: 2023-03-10T19:08:33.153Z (about 2 years ago)
- Language: Go
- Homepage:
- Size: 31.3 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Gel - Embedded Go templates
Gel is a templating library that compiles templates into Go functions.
## Installation
```
go get -u github.com/jackc/gel
```## Usage
```
gel < users_index.html | goimports > users_index.go
```## Example
```
package mainfunc main() {
t(os.Stdout)
}func t(w io.Writer) error
---
Hello, <%= "Jack" %>!
```All text above the `---` is emitted directly into the output file. The last line must be a function signature that has a `io.Writer`
named `w` and returns an `error`. The template below the `---` will be converted into the function body.