Home | 簡體中文 | 繁體中文 | 雜文 | 打賞(Donations) | Github | OSChina 博客 | 雲社區 | 雲棲社區 | Facebook | Linkedin | 知乎專欄 | 視頻教程 | About

4.11. 重命名檔案名

		
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