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

Simplifies whitespace control and adds an option #492

Merged
merged 1 commit into from
Apr 2, 2019
Merged

Conversation

JaneOri
Copy link
Contributor

@JaneOri JaneOri commented Mar 11, 2018

Simplifies whitespace control and adds an option for clearing whitespace without leaving any output behind.

Adds:

Special Case

You may want to remove all whitespace between elements without output or comment.

<ul>
	{{--}}
	<li>Inline Nav Item 1</li>
	{{--}}
	<li>Inline Nav Item 2</li>
	{{--}}
</ul>

would render as:

<ul><li>Inline Nav Item 1</li><li>Inline Nav Item 2</li></ul>

return spaceBefore + bracketBefore + expression + bracketAfter + spaceAfter;

});
return template.replace(/\s*\{\{--\}\}\s*|\s*(\{\{\{?)-|-(\}\}\}?)\s*/g, "$1$2");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generally a good practice to cache regexps.

@justinbmeyer
Copy link
Contributor

Looks good (though not quite ready to merge yet). Is this in handlebars or mustache? I wonder if it should be added as a "tag" in its own right, like these:

canjs_-_can-stache

@JaneOri
Copy link
Contributor Author

JaneOri commented Mar 29, 2019

Updated PR

image from the codepen result:
image

image of the added signature in docs:
image

image of the added use example in docs:
image

@JaneOri JaneOri requested a review from justinbmeyer March 29, 2019 09:28
@justinbmeyer
Copy link
Contributor

looks good .. @cherifGsoul can you merge and verify it looks right in the docs?

@cherifGsoul
Copy link
Member

@justinbmeyer it looks good in the docs, I'm gonna merge it!

@cherifGsoul cherifGsoul merged commit b530682 into master Apr 2, 2019
@cherifGsoul cherifGsoul deleted the whitespace2 branch April 2, 2019 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants