I'm getting a file and moving it with gulp:
gulp.src('src/myfile.html')
.pipe(gulp.dest('dist'));
How can I rename the file too?
I'm getting a file and moving it with gulp:
gulp.src('src/myfile.html')
.pipe(gulp.dest('dist'));
How can I rename the file too?
Try 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