Home | 簡體中文 | 繁體中文 | 雜文 | 打賞(Donations) | ITEYE 博客 | OSChina 博客 | Facebook | Linkedin | 知乎專欄 | Search | Email

4.8. 重命名檔案名

		
Using gulp-rename

npm install --save-dev gulp-rename
		
		

gulpfile.js:

		
// including plugins
var gulp = require('gulp');
var rename = require('gulp-rename');
var coffee = require("gulp-coffee");
 
// task
gulp.task('rename', function () {
    gulp.src('./CoffeeScript/one.coffee') // path to your file
    .pipe(coffee())  // compile coffeeScript
    .pipe(rename('renamed.js')) // rename into "renamed.js" (original name "one.js")
    .pipe(gulp.dest('path/to/destination'));
});
		
		

Run:

		
gulp rename