文章目录
  1. 1. gulp-rename重命名

gulp 对文件批量重命名

gulp-rename重命名

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
var gulp = require('gulp');
var rename = require("gulp-rename");

// rename via function
gulp.task('name', function() {
return gulp.src('./dist/**/*')
.pipe(rename(function(path) {
console.log(path)
var name = new Date().getTime();
path.basename = name;
}))
.pipe(gulp.dest('rename/'))
})

// rename via hash
gulp.task('name2', function() {
return gulp.src('./dist/**/*')
.pipe(rename({
dirname: "main",
basename: "dong",
prefix: "",
suffix: "",
extname: ""
}))
.pipe(gulp.dest('rename/'))
})
文章目录
  1. 1. gulp-rename重命名
顶部