gulp - variable directory followed by known one -
i want copy files from
/plugins/system/name/language/en—gb/* /language/en-gb/* /plugins/test/whatever/language/fr-fr/* /language/fr-fr/*
i have tried that
gulp.task('copy:plugins:lang', function () { return gulp.src('./plugins/**/**/language') .pipe(gulp.dest('language')); });
but copies directories inside language
directory
/language/system/name/language/en—gb/* /language/test/whatever/language/fr-fr/*
i have tried flatten() files there copied directly inside language
folder instead of en-gb
or fr-fr
.
note en-gb
or fr-fr
variable, pt-br
. using placeholders, trying achieve copying files like:
/plugins/{type}/{name}/language/{locale}/*
inside /language/{locale}/*
i think may able achieve want using gulp-rename
, path
. if it's safe assume there no directories inside each locale directory, use:
var rename = require('gulp-rename'); var path = require('path'); gulp.task('copy:plugins:lang', function () { return gulp.src('./plugins/**/language') .pipe(rename(function(file) { file.dirname = path.basename(file.dirname); })) .pipe(gulp.dest('language')); });
otherwise, may need more complex transform on file.dirname
.
Comments
Post a Comment