Created
May 8, 2018 09:12
-
-
Save AllenFang/78f41c60af8d69d6f9f9b2f426d398d1 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}/`)); | |
}); | |
// 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