Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added an option to remove extra whitespace around hbs tags
It annoys me and apparently many others that handlebars does not strip extra whitespace around its elements when compiling. handlebars-lang/handlebars.js#336 This is a quick hack to make it strip that extra whitespace as if the rows with only a single hbs tag were not separate rows. This pull possibly has some bugs in its regexp, but it's a start. I thought that maybe this should be toggleable by the user, so only by adding an option: removeHbsWhitespace:true to grunt config of assemble will enable this feature. (without it, no ill effects should happen) With removeHbsWhitespace enabled code like this: ``` {{#each collection}} <div>{{this}}</div> {{/each}} ``` normally resulting this: ``` <div>ele1</div> <div>ele2</div> <div>ele3</div> ``` would be preprocessed to be like this: ´´´ {{#each collection}}<div>{{this}}</div>{{/each}} ´´´ resulting this: ``` <div>ele1</div> <div>ele2</div> <div>ele3</div> ``` This feels more natural and helps creating cleaner and more readable layouts, partials and page code.
- Loading branch information