Created
May 8, 2018 15:11
-
-
Save AllenFang/b45524fc801bfb583d5368385e7eb531 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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