Created
July 30, 2019 17:32
-
-
Save ssmythe/54bf42dd73e742aacc05ee38d3d0e659 to your computer and use it in GitHub Desktop.
gomplate output map example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://github.com/hairyhenderson/gomplate | |
# templates/hello.tmpl | |
Hello, {{ .users.Name }} | |
# config.json | |
{ | |
"Name": "Steve" | |
} | |
# config.yaml (gomplate supports YAML as well) | |
Name: Steve | |
# gomplate --input-dir=templates/ --output-map='outputs/{{ .in | strings.ReplaceAll ".tmpl" "" }}' -c users=config.json | |
# cat outputs/hello | |
Hello, Steve | |
# The key is the context (-c) switch that determines the template namespace to be used. Use "." for root context. | |
# contexts can be overridden with multiple -c invocations on the same command line. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment