boilerplate.yml
The boilerplate.yml file is the configuration file at the root of every Boilerplate template. It defines variables,
dependencies, hooks, skip rules, partials, and engine overrides.
Top-Level Structure
Section titled “Top-Level Structure”required_version: ">= 0.5.0" # Optional version constraint
variables: - name: MyVar # ... variable definition
dependencies: - name: my-dep # ... dependency definition
hooks: before: - command: echo args: ["Starting..."] after: - command: echo args: ["Done!"]
partials: - ../partials/*.html
skip_files: - path: "*.test.go" if: "{{ not .IncludeTests }}"
engines: - path: "**/*.jsonnet" template_engine: jsonnetSections
Section titled “Sections”required_version
Section titled “required_version”An optional version constraint (Terraform-style) that ensures the user is running a compatible version of Boilerplate:
required_version: ">= 0.5.0, < 1.0.0"variables
Section titled “variables”A list of variable definitions. See the Variables page for the full reference.
dependencies
Section titled “dependencies”A list of child templates to process. See the Dependencies page for full details.
Shell commands to run before (before) or after (after) template rendering. See Hooks.
partials
Section titled “partials”A list of glob patterns for external template files that can be included via Go’s {{ "{{" }} template "name" . {{ "}}" }} syntax:
partials: - ../../partials/*.html - ../shared/footer.htmlPartials are defined in external files using {{ "{{" }} define "name" {{ "}}" }}...{{ "{{" }} end {{ "}}" }} and can be reused across multiple template files.
skip_files
Section titled “skip_files”Rules for excluding files from the output. See Skip Files.
engines
Section titled “engines”Override the template engine for specific files. Currently supports jsonnet as an alternative to the default Go template engine:
engines: - path: "**/*.jsonnet" template_engine: jsonnetMissing Config Behavior
Section titled “Missing Config Behavior”If a template directory doesn’t contain a boilerplate.yml, Boilerplate’s behavior depends on the --missing-config-action flag:
| Value | Behavior |
|---|---|
exit (default) | Exit with an error |
ignore | Log a warning and process files without variable substitution |