nclgen generates resources in directories relative to the project root,
which is a directory that contains a ncl.gen subdir.
nclgen generate generates outputs based on targets definitions inside the ncl.gen/config.toml file.
nclgen check checks that generated outputs are up-to-date.
nclgen imports prints the import paths that nclgen adds to the evaluation.
nclgen targets prints the list of available targets from the configuration.
nclgen debug evaluates targets and prints the result.
See example directory for a quick look at how a nclgen project works.
nclgen requires the Nickel evaluation to produce a record of strings:
-
The fields of the record must be file paths relative to project root and can't contain any
/./or/../components. -
The string values become the content of the generated files.
By default nclgen expects that the whole evaluation result is the outputs record.
Use the targets.<target>.outputs_field config option to set which field contains the outputs record.
See src/project/config.rs for the full ncl.gen/config.toml schema.
By default, nclgen will use the nickel binary from the environment.
You can override the binary used using the NCLGEN_NICKEL_PATH env var.
In order for Nickel Language Server to resolve imports that will be available during nclgen
evaluation, you can add the output of nclgen imports to the NICKEL_IMPORT_PATH env var.
readonly NCLGEN_IMPORTS="$(nclgen imports)"
if [[ -n "$NCLGEN_IMPORTS" ]]; then
if [[ -z "$NICKEL_IMPORT_PATH" ]]; then
export NICKEL_IMPORT_PATH="$NCLGEN_IMPORTS"
else
export NICKEL_IMPORT_PATH="$NCLGEN_IMPORTS:$NICKEL_IMPORT_PATH"
fi
fi