Last active
December 14, 2015 21:08
-
-
Save kalepail/169d64e5e1889f712289 to your computer and use it in GitHub Desktop.
Rename files with Gulp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require("gulp"); | |
var rename = require("gulp-rename"); | |
gulp.task('default', function() { | |
return gulp.src("./*.md") | |
.pipe(rename(function(path) { | |
path.basename = path.basename.replace(/(\D*\d{4}-\D*\d{2}-\D*\d{2})(-)/, "$1."); | |
})) | |
.pipe(gulp.dest("./renamed")); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "gulp-rename", | |
"version": "1.0.0", | |
"main": "gulpfile.js", | |
"author": "Tyler van der Hoeven", | |
"devDependencies": { | |
"gulp": "^3.9.0", | |
"gulp-rename": "^1.2.2" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment