templating
This module provides template rendering capabilities using Go's text/template package.It supports loading templates from local files or HTTPS URLs, and accepts variables
from YAML files or command-line parameters.
Templates can use any file extension, with optional .tmpl suffix that will be
automatically removed in the output. Variables can be provided via a YAML file,
command-line key=value pairs, or both (command-line takes precedence).
The module can be called from the dagger CLI or from any of the Dagger SDKs.
Installation
dagger install github.com/stuttgart-things/dagger/templating@v0.46.0Entrypoint
Return Type
Templating Example
dagger -m github.com/stuttgart-things/dagger/templating@d64d59d9027ee4cfa12a3704ab8e4a09e53eb94e call \
func (m *MyModule) Example() *dagger.Templating {
return dag.
Templating()
}@function
def example() -> dagger.Templating:
return (
dag.templating()
)@func()
example(): Templating {
return dag
.templating()
}Types
Templating 🔗
render() 🔗
RenderTemplates renders Go templates with provided variables templates: comma-separated list of template paths (local in src or HTTPS URLs) variables: comma-separated list of key=value pairs (e.g., “name=John,age=30”) variablesFile: optional YAML file with variables (variables parameter has higher priority) strictMode: if true, fail on missing variables; if false, render as “” (default: false)
Return Type
Directory !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| src | Directory ! | - | No description provided |
| templates | String ! | - | No description provided |
| variables | String | - | No description provided |
| variablesFile | String | - | No description provided |
| strictMode | Boolean | - | No description provided |
Example
dagger -m github.com/stuttgart-things/dagger/templating@d64d59d9027ee4cfa12a3704ab8e4a09e53eb94e call \
render --src DIR_PATH --templates stringfunc (m *MyModule) Example(src *dagger.Directory, templates string) *dagger.Directory {
return dag.
Templating().
Render(src, templates)
}@function
def example(src: dagger.Directory, templates: str) -> dagger.Directory:
return (
dag.templating()
.render(src, templates)
)@func()
example(src: Directory, templates: string): Directory {
return dag
.templating()
.render(src, templates)
}