gulp-rename is a gulp plugin to rename files easily.
gulp-rename provides simple file renaming methods.
var rename = ;// rename via stringgulp; // ./dist/main/text/ciao/goodbye.md// rename via functiongulp; // ./dist/main/text/ciao/hello-goodbye.md// rename via hashgulp; // ./dist/main/text/ciao/bonjour-aloha-hola.md
See test/rename.spec.js for more examples and test/path-parsing.spec.js for hairy details.
dirnameis the relative path from the base directory set by
gulp.srcto the filename.
gulp.src()uses glob-stream which sets the base to the parent of the first directory glob (
**, , or extglob).
dirnameis the remaining directories or
./if none. glob-stream versions >= 3.1.0 (used by gulp >= 3.2.2) accept a
baseoption, which can be used to explicitly set the base.
gulp.dest()renames the directories between
dirname(i.e. the base relative to CWD). Use
dirnameto rename the directories matched by the glob or descendents of the base of option.
basenameis the filename without the extension like path.basename(filename, path.extname(filename)).
extnameis the file extension including the '.' like path.extname(filename).