Dagger
Search

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.63.0

Entrypoint

Return Type
Templating
Example
dagger -m github.com/stuttgart-things/dagger/templating@7238809bbf195ee5367194ad8b29f2b7829d6f23 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
NameTypeDefault ValueDescription
srcDirectory !-No description provided
templatesString !-No description provided
variablesString -No description provided
variablesFileString -No description provided
strictModeBoolean -No description provided
Example
dagger -m github.com/stuttgart-things/dagger/templating@7238809bbf195ee5367194ad8b29f2b7829d6f23 call \
 render --src DIR_PATH --templates string
func (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)
}

renderFromFile() 🔗

RenderFromFile renders Go templates with data loaded from a YAML or JSON file templates: comma-separated list of template paths (local in src or HTTPS URLs) dataFile: path to YAML or JSON file containing template data (local in src or HTTPS URL, file extension determines format) strictMode: if true, fail on missing variables; if false, render as “” (default: false)

Return Type
Directory !
Arguments
NameTypeDefault ValueDescription
srcDirectory -No description provided
templatesString !-No description provided
dataFileString !-No description provided
strictModeBoolean -No description provided
Example
dagger -m github.com/stuttgart-things/dagger/templating@7238809bbf195ee5367194ad8b29f2b7829d6f23 call \
 render-from-file --templates string --data-file string
func (m *MyModule) Example(templates string, dataFile string) *dagger.Directory  {
	return dag.
			Templating().
			RenderFromFile(templates, dataFile)
}
@function
def example(templates: str, data_file: str) -> dagger.Directory:
	return (
		dag.templating()
		.render_from_file(templates, data_file)
	)
@func()
example(templates: string, dataFile: string): Directory {
	return dag
		.templating()
		.renderFromFile(templates, dataFile)
}

renderInline() 🔗

RenderInline renders a Go template from an inline string

Return Type
String !
Arguments
NameTypeDefault ValueDescription
templateDataString !-No description provided
variablesString -No description provided
strictModeBoolean -No description provided
Example
dagger -m github.com/stuttgart-things/dagger/templating@7238809bbf195ee5367194ad8b29f2b7829d6f23 call \
 render-inline --template-data string
func (m *MyModule) Example(ctx context.Context, templateData string) string  {
	return dag.
			Templating().
			RenderInline(ctx, templateData)
}
@function
async def example(template_data: str) -> str:
	return await (
		dag.templating()
		.render_inline(template_data)
	)
@func()
async example(templateData: string): Promise<string> {
	return dag
		.templating()
		.renderInline(templateData)
}