I have a gulpfile that defines two tasks: 'english' and 'italian'.
They actually return several subtasks, one for the website pages, one task for each team member HTML snippet and one for client side localised strings.
I am having problems with the team member snippets tasks. The team member subtasks of the 'italian' task override for no reason the output of the 'english' subtasks.
Both 'english' and 'italian' tasks work as intended if run separately, but I'd like them to both run in the 'default' task.
It seems something is shared when using the same gulp instance, but it doesn't really make sense to me.
I'm on macOS Mojave with Node v10.16.0, gulp 3.9.1.
Has anyone ever had similar problems?
This is a minimal template to reproduce the error:
{%esc:s}
<p>{localisedDescription}</p>
{/esc}
And the gulpfile:
const gulp = require('gulp');
const rename = require('gulp-rename');
const dusthtml = require('gulp-dust-html');
const content = {
teamMembers: [
{
detailPageName: 'A.html',
description: {
en: `Description A.`,
it: `Descrizione A.`
}
},
{
detailPageName: 'B.html',
description: {
en: `Description B.`,
it: `Descrizione B.`
}
}
]
};
gulp.task('english', function () {
const teamDetailPagesTask = content.teamMembers.map(member => {
member.localisedDescription = member.description['en'];
return gulp.src('templates/bug-team-member-detail.dust')
.pipe(dusthtml({
basePath: 'templates',
data: member
}))
.pipe(rename(member.detailPageName))
.pipe(gulp.dest('bug/en'));
});
return [...teamDetailPagesTask, /* other tasks here */];
});
gulp.task('italian', function () {
const teamDetailPagesTask = content.teamMembers.map(member => {
member.localisedDescription = member.description['it'];
return gulp.src('templates/bug-team-member-detail.dust')
.pipe(dusthtml({
basePath: 'templates',
data: member
}))
.pipe(rename(member.detailPageName))
.pipe(gulp.dest('bug/it'));
});
return [...teamDetailPagesTask, /* other tasks here */];
});
gulp.task('default', ['english', 'italian']);