Last active
December 1, 2017 16:35
-
-
Save jimimaher/a4ba6d555f9d358e4629bee5a4134534 to your computer and use it in GitHub Desktop.
Gulp batch remove character in filename
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
//Below example is to replace `_` in non-vendor `.scss` files. | |
var gulp = require('gulp'); | |
var del = require('del'); | |
var rename = require('gulp-rename'); | |
gulp.task('cloneFilesWithoutChar', function(){ | |
return gulp.src([ | |
'/**/*.scss', //example | |
'!/**/vendor/**' | |
]) | |
.pipe(rename (function(path) { | |
path.basename = path.basename.replace('_', ''); | |
return path.dirname + path.basename | |
})) | |
.pipe(gulp.dest('.')) | |
}) | |
gulp.task('removeOldFileWsithChar', function(){ | |
del([ | |
'/**/_*.scss', | |
'!/**/vendor/**' | |
]) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment