Skip to content

Partials used with object of partials removes space #826

@ToddJ101

Description

@ToddJ101

Issue description:
Between the versions 3.0.1 and 3.0.2-4.2.0 a change was introduced that affects templates that only have spaces and an object of partials. Previous template output respected the space in the template string, behavior of v3.0.2, and after removes the space in the template string between replaced object partials.

Expected Behavior
When I use the third parameter of .render(template, {}, partials) sending in an object of partials. The template with only spaces between the partials should keep my template string spaces between partial nodes.

Code Example:
const template = '{{> Container1}} {{> Container2}} {{> Container3}}'

// The partial I am using
const partials = {
Container1: 'Container1',
Container2: 'Container2',
Container3: 'Container3'
}

// THE MUSTACHE CALL
const newValues = mustache.render(template, {}, partials)

// 3.0.1 OUTPUT of newValues:
console.log(newValues) // Container1 Container2 Container3

// 3.0.2-4.2.0 OUTPUT of newValues:
console.log(newValues) // Container1Container2Container3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions