Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sentriz/tmplc
dead simple command line tool for go's standard library text/template
https://github.com/sentriz/tmplc
Last synced: 3 days ago
JSON representation
dead simple command line tool for go's standard library text/template
- Host: GitHub
- URL: https://github.com/sentriz/tmplc
- Owner: sentriz
- Created: 2023-08-29T20:59:07.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-09-01T15:16:46.000Z (over 1 year ago)
- Last Synced: 2024-12-11T22:05:23.268Z (22 days ago)
- Language: Go
- Homepage:
- Size: 4.88 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme
Awesome Lists containing this project
README
dead simple command line tool for go's standard library text/template
install:
$ go install go.senan.xyz/tmplc@latest
usage:
$ tmplc [FILE]...
FILE can be any number of "partials" or "leaves". where leaves have a ".tmpl" suffix, and partials are everything else.
after parsing all partials and leaves, new files will be created for the leaves without the ".tmpl" suffix.
it's even possible to use it as a static site generator:
$ cat partials
{{ define "layout" }}
{{ template "title" }}
{{ template "content" }}
{{ end }}$ cat page-1.html.tmpl
{{ define "title" }}page one{{ end }}
{{ define "content" }}hello from page 1{{ end }}
{{ template "layout" }}$ cat page-2.html.tmpl
{{ define "title" }}page two{{ end }}
{{ define "content" }}hello from page 2{{ end }}
{{ template "layout" }}$ tmplc partials *.tmpl
$ cat page-1.html
page one
hello from page 1
$ cat page-2.html
page two
hello from page 2