Open
Description
Hello,
I would be nice for please to support templating text files. It is especially useful to render config files using information from the build system.
the user could choose what templating engine they want to use.
The interface could look like this:
config = template(
name = "render_config",
source = "config.txt.j2",
vars = {
"a": 54,
"b": ["a", "b", "c"],
"c": "hello",
},
engine = "jinja2",
out = "config.txt",
)
It could support all the major templating engines jinja2 mustache twig ...
To achieve this, a potential implementation approach similar to how 'arcat' is used could be adopted. This entails introducing a pre-build binary that takes an input file, along with the required variables, and renders the output file.
If the binary is not already available, it should be downloaded as necessary.