hparra/gulp-rename

Extension ignored if not the same as the src extension.

sketchbuch opened this issue · 8 comments

I have a task for converting less to css and minifying it.

gulp.task('styles', function() { return gulp.src(srcDir + 'css/**/*.less') .pipe(plumber({ errorHandler: onError })) .pipe(less()) .pipe(cssimport({cssImportOpts})) .pipe(cssmin()) .pipe(rename('app.css')) .pipe(gulp.dest(destDir + 'css/')); });

It works as expected but instead of calling the file "all.css", it is just called "all". If however I change the name to "all.less" rename changes the file to "all.less"

That shouldn't be the case at all, what does this do?

gulp.src('somefile.less').pipe(rename('somefile.css')).pipe(gulp.dest('out'))

The same... "somefile" is created, not "somefile.css"

Windows 8
Node 6.9.5
Gulp CLI 1.2.2
Gulp Local 4.0.0.alpha2

If you want a workaround you can use rename({ extname: 'css' }) while I look into this

I'm looking through the code and I don't see anything that would cause this to happen, if you provide a string as the argument it uses that as the new file path - nothing fancy happening there. This is a pretty common case so I think it would have been reported already if it wasn't working.

Are you on the latest versions of your dependencies?

.pipe(rename({extname: 'css', basename: 'all'}))

creates the file "allcss"

.pipe(rename({extname: '.css', basename: 'all'}))

Creates the same

Here is my full gulpfile
https://pastebin.com/gr8YUAdP

Sorry!

My mistake. I haven't used windows for years and am only doing so as my Linux laptop is being repaired. Windows hides file extensions of know filetypes.

Sorry again.