2016-11-09 7 views
0

Ich erhalte eine Datei und es mit schluck bewegen:Umbenennen einer Datei beim Verschieben in Schluck?

gulp.src('src/myfile.html') 
.pipe(gulp.dest('dist')); 

Wie kann ich auch die Datei umbenennen?

+0

Mögliche Duplikat [Gulp - kopieren und Umbenennen einer Datei] (http://stackoverflow.com/questions/28593660/gulp-copy-and-rename-a-file) –

Antwort

1

Versuchen https://www.npmjs.com/package/gulp-rename

// rename via string 
gulp.src("./src/main/text/hello.txt") 
    .pipe(rename("main/text/ciao/goodbye.md")) 
    .pipe(gulp.dest("./dist")); // ./dist/main/text/ciao/goodbye.md 


// rename via function 
gulp.src("./src/**/hello.txt") 
    .pipe(rename(function (path) { 
    path.dirname += "/ciao"; 
    path.basename += "-goodbye"; 
    path.extname = ".md" 
    })) 
    .pipe(gulp.dest("./dist")); // ./dist/main/text/ciao/hello-goodbye.md 
Verwandte Themen