vim-stringify is a small plugin that turns your raw templates into concatenated strings.
Here is your raw template :
<div class="post">
<h1>By {{fullName author}}</h1>
<div class="body">{{body}}</div>
<h1>Comments</h1>
{{#each comments}}
<h2>By {{fullName author}}</h2>
<div class="body">{{body}}</div>
{{/each}}
</div>
:call Stringify()
will turn it into this:
'<div class="post">' +
'<h1>By {{fullName author}}</h1>' +
'<div class="body">{{body}}</div>' +
'<h1>Comments</h1>' +
'{{#each comments}}' +
'<h2>By {{fullName author}}</h2>' +
'<div class="body">{{body}}</div>' +
'{{/each}}' +
'</div>'
Install using vundle
Bundle '29decibel/vim-stringify'
Key mapping
map <leader>g :call Stringify()<CR>
Enjoy!