gulp工具rename
gulp-rename重命名
1 var gulp = require('gulp'); 2 var rename = require("gulp-rename"); 3 // rename via function 4 gulp.task('name', function() { 5 return gulp.src('./dist/**/*') 6 .pipe(rename(function(path) { 7 console.log(path) 8 var name = new Date().getTime(); 9 path.basename = name; 10 })) 11 .pipe(gulp.dest('rename/')) 12 }) 13 // rename via hash 14 gulp.task('name2', function() { 15 return gulp.src('./dist/**/*') 16 .pipe(rename({ 17 dirname: "main", 18 basename: "dong", 19 prefix: "", 20 suffix: "", 21 extname: "" 22 })) 23 .pipe(gulp.dest('rename/')) 24 })