Closed bretthayes closed 9 years ago
Use gulp-if
.pipe(gif('oldFileName.html', rename('newFileName.html'))
@contra Doesn't work. The output to my build folder still compiles the original file names. Any ideas?
gulp.task('compile:jade', function() {
return gulp.src(paths.jade)
.pipe($.jade())
.pipe($.if('oldFileName.html', $.rename('newFileName.html')))
.pipe($.if('otherFile.html', $.rename('otherFile.txt')))
.pipe(gulp.dest(paths.build));
});
@robrich Shouldn't that work with gulp-if?
@bretthayes Could you show us the values of paths.jade
?
@shinnn, @contra
// gulp-if, gulp-rename, and gulp-jade are installed via npm
var gulp = require('gulp'),
$ = require('gulp-load-plugins')();
var paths = {
jade: './src/jade/**/*.jade',
build: './build'
};
gulp.task('compile:jade', function() {
return gulp.src(paths.jade)
.pipe($.jade())
.pipe($.if('**/oldFileName.html', $.rename({basename: 'newFileName'})))
.pipe($.if('**/otherFile.html', $.rename({
basename: 'otherFile',
extname: '.txt'
})))
.pipe(gulp.dest(paths.build));
});
@shinnn Perfect! Specifying the asterisks for the source made it work: **/oldfileName.html
.
Also using gulp-debug
confirmed the path ./src/jade/oldFileName.html
being output during the compilation.
Thanks guys!
No problem :)
Is there support for this? For example: