Mustache Template
Turn one prompt with {placeholders} into a whole batch
- variable_sets
- rendered_text
You know the drill: you want to test six hair colors, three lighting moods, and four leg lengths, and you're about to hand-write the Cartesian product of prompts and queue them one at a time. This node is the automated version. You give it a template with {{placeholders}} and a list of concrete variable settings, and it renders one string per setting - a STRING list that, when connected to CLIP Text Encode, makes ComfyUI run the sampler once per rendered prompt. Prompt permutation, the ComfyUI way.
It's deliberately dumb and proud of it: the node no longer computes permutations itself. It receives an already-expanded list of variable settings (from Mustache Variable Sampler) and just fills in the template for each entry. For the default template and two hair colors × three leg lengths, you get exactly six strings, in order:
The man has brown hair and short legs.
The man has brown hair and long legs.
The man has brown hair and weird legs.
The man has blonde hair and short legs.
...
The inputs
variable_sets- aMUSTACHE_VARIABLE_LIST: the concrete assignments produced byMustache Variable Sampler(orMustache Variable Setfor a single one). One rendered prompt per entry.template- the text with{{name}}placeholders. Every placeholder must exist in each setting entry, and repeated placeholders reuse the same selected value within a single render (so{{color}} hair with {{color}} eyesstays consistent).
Output: rendered_text, a list-valued STRING.
A few behaviors worth knowing. Variables present in a setting but not referenced in the template are ignored. Templates with no placeholders just repeat once per entry. And referencing a missing variable raises an error rather than silently leaving {{name}} in your prompt - which is the right call, because a literal {{haircolor}} in your final prompt is the kind of bug that eats an hour.
Installing and using it
Part of Skoogeer-Noise. ComfyUI Manager → search "Skoogeer-Noise", or:
cd ComfyUI/custom_nodes
git clone https://github.com/ttulttul/Skoogeer-Noise
Restart ComfyUI. No models, no keys; deps are torch, numpy, einops, pyyaml.
The full pipeline is Mustache Variables (define candidates in YAML) → Mustache Variable Sampler (expand to concrete settings, cap the count) → Mustache Template (render) → CLIP Text Encode. Two gotchas that catch everyone. First: ComfyUI's built-in Preview as Text only shows the first item of a list-valued string - feed Join Text List first if you want to inspect the whole batch. Second: permutation explosion. If your candidate pools are big, the sampler's limit is where you cap it - with limit left at -1 and a product over 100,000 entries, the sampler raises an error on purpose so your workflow doesn't look frozen while it materializes a quarter-million prompts.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| variable_sets | MUSTACHE_VARIABLE_LIST | Concrete mustache variable settings generated by Mustache Variable Sampler. One rendered prompt is produced for each list entry. | |
| template | STRING | The man has {{haircolor}} hair and {{leglength}} legs. | Template text containing placeholders like {{haircolor}}. The node renders the template once for each variable-setting entry. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| rendered_text | STRING | — |