Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inserted hbs files use inconsistent whitespace with parent template #811

Closed
mrowles opened this issue Jun 19, 2014 · 4 comments
Closed

Inserted hbs files use inconsistent whitespace with parent template #811

mrowles opened this issue Jun 19, 2014 · 4 comments

Comments

@mrowles
Copy link

mrowles commented Jun 19, 2014

Is there any way to fix the following issue, and if not, can this be addressed in a future release?

The following code:

        <div class="row">
            <div class="col-xs-12">
                {{> component}}
            </div>
        </div>

compiles to:

        <div class="row">
            <div class="col-xs-12">
    <div class="component">
        Some text
    </div>
            </div>
        </div>

Apologies if this is an isolated issue, I am looking into a fix in my spare time also.

@jokesterfr
Copy link

Cannot understand why this is acting this way either. Same issue with Mustache compiler.

@kpdecker
Copy link
Collaborator

Handlebars, and mustache, are agnostic of language-level constructs such as indenting and will output the literal whitespace that you define. When using partials the indenting will only impact the first line if the partial has multiple lines.

Why is it that you want to have the nesting match? For debugging mostly?

@mrowles
Copy link
Author

mrowles commented Jun 24, 2014

Mainly for neater templates. It's 100% a nice to have, but I think the importance lies in debugging like you said i.e., diff checks can ignore white space of course, but in GH it requires a parameter in the URL to do this.

In our instance we are building templates and passing them to our backend team to build into the CMS, so they're either tidied up by us, them or we have messy HTML code.

@kpdecker kpdecker added this to the Backlog milestone Jul 5, 2014
@kpdecker kpdecker modified the milestones: Backlog, 2.0 Aug 13, 2014
@kpdecker
Copy link
Collaborator

It turns out that the mustache spec dictates the indent behavior for partials and requires indentation for standalone partials (partials that are on their own line). This change will be implemented by #787, which should be merged soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants