Gulp: Rename certain file from source directory while copying -


i copy folder destination , rename file in same process.

gulp.task('deploy', function () { gulp.src(['xxx/**/*']).pipe(gulp.dest('yyy')); });

i able copy folder on fine how go renaming file?

source folder structure:

- xxx (root)   - scripts     - config       - app.config.local.js (would rename file app.config.js)       - app.config.dev.js 

you can use gulp-rename plugin rename files , gulp-if plugin make sure renaming applied 1 particular file:

var gulp = require('gulp'); var rename = require('gulp-rename'); var _if = require('gulp-if');  gulp.task('deploy', function() {   return gulp.src(['xxx/**/*'])     .pipe(_if('**/app.config.local.js', rename({basename:'app.config'})))     .pipe(gulp.dest('yyy')); }); 

Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -