Skip to content

Instantly share code, notes, and snippets.

@AllenFang
Created May 8, 2018 15:11
Show Gist options
  • Save AllenFang/b45524fc801bfb583d5368385e7eb531 to your computer and use it in GitHub Desktop.
Save AllenFang/b45524fc801bfb583d5368385e7eb531 to your computer and use it in GitHub Desktop.
import gulp from 'gulp';
import gulpJsonTransform from 'gulp-json-transform';
import countryList from './config/countries'; // it's an array of string
// omit clean, distribute etc
function patchManifest(done) {
const tasks = countryList.map((countryName) => {
// Right here, we return a function per country
return () =>
gulp.src(`./build/${countryName}/manifest.json`)
.pipe(gulpJsonTransform((data) => {
data.homepage_url = .....; // Something different here by country
return data;
}))
.pipe(gulp.dest(`./build/${countryName}/`));
});
return gulp.series(...tasks, (seriesDone) => {
seriesDone();
done();
})();
}
const demo = gulp.series(clean, distribute, patchManifest, archive);
gulp.task('demo', demo);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment