Skip to content

Instantly share code, notes, and snippets.

@jimimaher
Last active December 1, 2017 16:35
Show Gist options
  • Save jimimaher/a4ba6d555f9d358e4629bee5a4134534 to your computer and use it in GitHub Desktop.
Save jimimaher/a4ba6d555f9d358e4629bee5a4134534 to your computer and use it in GitHub Desktop.
Gulp batch remove character in filename
//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