I have a problem with my Gulp tasks. I use one task to create multiple html files with gulp-mustache, so that I have two files (index_de.html and index_en.html) at the end. I have a .json file, that contains the strings. It all works fine. But I always end up with either both files being de or en, instead of one file per language. I already tried creating tasks using a loop [gulp], but that doesn't work.
Edit: to clarify: Both files contain the same content. Always. Seems randomly what language it will be, but it's always the same.
My Gulp tasks looks like the following:
gulp.task('mustache', function () {
console.log('Found '+Object.keys(strings).length+' languages.');
for (var l in strings) {
var lang = strings[l];
(function(lang, l) {
gulp.src(buildpath+'/index.html')
.pipe(mustache(lang))
.pipe(rename('index_'+l+'.html'))
.pipe(compressor({
'remove-intertag-spaces': true,
'compress-js': true,
'compress-css': true
}))
.pipe(gulp.dest(destpath+'/'));
})(lang, l);
}
});