Thursday, May 23, 2024
 Popular · Latest · Hot · Upcoming
132
rated 0 times [  137] [ 5]  / answers: 1 / hits: 28613  / 10 Years ago, mon, february 24, 2014, 12:00:00

Is there a plugin available for Gulp that does the same thing as Assemble does for Grunt?


I would like to run a task for Gulp that assembles HTML partials, but I cannot find a plugin. Has anyone used one and can you provide a link to it?




UPDATE: 4/21/2016


Lately, I've been using Twig.js with Gulp, along with gulp-data to render JSON in my templates. My article goes into detail. Hint: You could also use Nunjucks, Swig.js, Handlebars etc.


Article: Frontend templating with Gulp and Twig.js


More From » gulp

 Answers
16

Yes, you can do it with this plugin called gulp-file-include



Example :



# index.html



<!DOCTYPE html>
<html>
<body>
@@include('./view.html')
@@include('./var.html', {
name: haoxin,
age: 12345
})
</body>
</html>


# view.html



<h1>view</h1>


# var.html



<label>@@name</label>
<label>@@age</label>

[#72335] Sunday, February 23, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
alanisannettep

Total Points: 695
Total Questions: 96
Total Answers: 91

Location: Australia
Member since Sat, May 27, 2023
1 Year ago
;