Bazel rules for rendering minijinja templates. Minijinja is a powerful and minimal template engine for Rust, compatible with Jinja2 syntax.
Add to your MODULE.bazel:
bazel_dep(name = "rules_minijinja", version = "<version>")To use a commit rather than a release, you can use archive_override:
bazel_dep(name = "rules_minijinja", version = "")
archive_override(
module_name = "rules_minijinja",
urls = "https://github.com/dududko/rules_minijinja/archive/<commit>.tar.gz",
strip_prefix = "rules_minijinja-<commit>",
# integrity = "sha256-...", # optional
)Workspace mode is not supported.
See the release notes for version-specific installation instructions and sha256 checksums.
load("@rules_minijinja//minijinja:defs.bzl", "minijinja_template")
minijinja_template(
name = "greeting",
template = "greeting.txt.j2",
out = "greeting.txt",
substitutions = {
"name": "World",
"language": "English",
},
)minijinja_template(
name = "config",
template = "config.yaml.j2",
out = "config.yaml",
data = ["context.json"],
substitutions = {
"version": "1.0.0",
},
)See the color palette example for a complete demonstration of using minijinja templates to generate Python code from YAML specifications.
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.