Nodes/Skoogeer-Noise/Mustache Variable
ComfyUI Node

Mustache Variable

Build one prompt variable without writing YAML

By ttulttul·Created 9 months ago·Updated 3 months ago· 14
Mustache Variable
    • variable_defs
    variable_nameanimal
    variable_valuesfox

    The mustache pipeline in this pack normally starts with a big YAML block (Mustache Variables) listing every variable and its candidate values. That's great when you have a dozen variables. It's overkill when you have one. Mustache Variable is the small hammer: it builds a single-key variable definition from a name and a value - no YAML, no parser, no ceremony. Name it animal, give it fox, and out comes {"animal": ["fox"]} as a MUSTACHE_VARIABLES mapping.

    Its real superpower is that it's a bridge from list-valued text. The variable_values input is a STRING socket that can be a list - so you can connect the output of some other node that produces a list of strings (a list of styles, a list of artists, whatever) and every item becomes a candidate value under your variable name. That's the move the README highlights: connecting a list-valued STRING output into variable_values turns it into that variable's candidate pool without touching YAML. That's how you chain prompt-generation tools into the mustache pipeline.

    The inputs and output

    • variable_name (default animal) - the name. It's trimmed, must be non-empty, and can't use the pack's reserved/internal names.
    • variable_values (default fox) - a scalar becomes a one-item candidate list; a connected STRING list becomes multiple candidates, in order.

    Output: variable_defs of type MUSTACHE_VARIABLES - a definition, not a concrete setting. That distinction is the whole mental model of this pack: definitions (MUSTACHE_VARIABLES) describe the pools of options; concrete sets (MUSTACHE_VARIABLE_LIST) are one specific assignment per prompt. If you want the concrete thing directly, that's the sibling node Mustache Variable Set, which skips the sampling step entirely. Here, you feed the output into Mustache Variable Sampler to expand it, or into Merge Mustache Variable Defs to combine with other definitions first.

    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 or keys; deps are torch, numpy, einops, pyyaml.

    When to reach for it vs. the YAML node

    If you're defining several variables that reference each other (a hairstyle that embeds {{color}}), use Mustache Variables - it supports in-YAML references and placeholders. Use this node when you have one variable, or when a variable's candidates come from somewhere else in the graph as a list. A dead-simple starter workflow: Mustache VariableMustache Variable SamplerMustache TemplateCLIP Text Encode, and you've got batch prompt variation with zero YAML in sight. One footgun to file away: this returns MUSTACHE_VARIABLES, and if you plug that straight into Mustache Template expecting it to work, it won't - the template wants the sampled list, so the sampler step isn't optional.

    Categorytext/template

    Inputs (2)

    NameTypeDefaultDescription
    variable_nameSTRINGanimalVariable name to define in the returned MUSTACHE_VARIABLES mapping.
    variable_valuesSTRINGfoxValue or list-valued STRING input to store under variable_name. A scalar becomes a single-item candidate list; a connected STRING list becomes multiple candidate values.

    Outputs (1)

    NameTypeDescription
    variable_defsMUSTACHE_VARIABLES