rules_minijinja
v0.1.0
published 3 weeks ago
1 stars
0 forks
1 watchers
Apache License 2.0
public
4 assets
60 downloads
52 KB
Compatibility level unknown
K24riAhq4478Tb6uLYhRBELdmRPDS3YYZ0BTn96n8yc=
Maintained byAlexei Dudko
v0.1.0
October 19, 2025
[expand for release notes]

Bazel rules for minijinja

Bazel rules for rendering minijinja templates. Minijinja is a powerful and minimal template engine for Rust, compatible with Jinja2 syntax.

Installation

Using Bzlmod (Bazel 6+)

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
)

Using WORKSPACE

Workspace mode is not supported.

See the release notes for version-specific installation instructions and sha256 checksums.

Usage

Basic Example

load("@rules_minijinja//minijinja:defs.bzl", "minijinja_template")

minijinja_template(
    name = "greeting",
    template = "greeting.txt.j2",
    out = "greeting.txt",
    substitutions = {
        "name": "World",
        "language": "English",
    },
)

With Data Files

minijinja_template(
    name = "config",
    template = "config.yaml.j2",
    out = "config.yaml",
    data = ["context.json"],
    substitutions = {
        "version": "1.0.0",
    },
)

Advanced: Code Generation

See the color palette example for a complete demonstration of using minijinja templates to generate Python code from YAML specifications.

Documentation

  • Examples - Usage examples
  • E2E Tests - End-to-end test cases demonstrating various use cases

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.