-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
I am using gulp-token-replace in my pug files:
my JSON:
{
"title" : "title",
"headline" : "Headline 1"
}
My Pug:
section
h2 {{title}}
Now with gulp I compile the pug and make sure that token-replace starts only after pug is finished. The output is this:
<section>
<h2>title</h2>
</section>ion>
Somehow token-replace adds the stuff after the </section>.
Strangely this does not happen when I run the gulp tasks one after the other by hand.
Terminal tells me that the pug task has finished when token-replace has started, so this should not happen.
My Gulpfile:
// wait function to make sure tasks are finished before the next one starts
function wait(ms){
var start = new Date().getTime();
var end = start;
while(end < start + ms) {
end = new Date().getTime();
}
}
gulp.task("pug", function() {
return gulp.src(activeProject + "*.pug")
.pipe(pug({
pretty: true
}))
.pipe(gulp.dest(activeProject + "build/"))
, wait(500)
});
gulp.task("token-replace", function(){
var config = require(activeProject + "json/data.json");
return gulp.src([activeProject + "build/*.html"])
.pipe(replace({global: config}))
.pipe(gulp.dest("build/"))
});
gulp.task("build-html", ["pug", "token-replace"]);
Metadata
Metadata
Assignees
Labels
No labels