Skip to content

Instantly share code, notes, and snippets.

@AllenFang
Created May 8, 2018 09:12
Show Gist options
  • Save AllenFang/78f41c60af8d69d6f9f9b2f426d398d1 to your computer and use it in GitHub Desktop.
Save AllenFang/78f41c60af8d69d6f9f9b2f426d398d1 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}/`));
});
// tasks is an array of function
// so how can I register those functions to gulp.series or gulp.parallel?
}
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