Reputation: 63
I am using Handlebars as a templating language for creating email and print communication templates. The templates share common elements and so I'm moved them into partials.
The issue I'm facing is that I'm looking to have a gulp task that creates a templates from the main body file and the partials but without touching the variables i.e. the output from this task should be a Handlebars template that will be used later by a different application to inject variables and send the communications.
I can't find a working gulp and handlebars package that will let me do this. Any ideas?
Upvotes: 0
Views: 178
Reputation: 135
I'm not sure I complete get the scenario but it seems you can use gulp-html-extend
to build an intermediary state that contains the main and the partials expanded. Hope it helps.
Example from the plugin:
master.html
<body>
<!-- @@placeholder= content -->
<!-- @@placeholder =footer -->
</body>
content.html
<!-- @@master = master.html-->
<!-- @@block = content-->
<main>
my content
</main>
<!-- @@close-->
<!-- @@block = footer-->
<footer>
my footer
</footer>
<!-- @@close-->
output
<body>
<!-- start content -->
<main>
my content
</main>
<!-- end content -->
<!-- start footer -->
<footer>
my footer
</footer>
<!-- end footer -->
</body>
Upvotes: 1