hparra / gulp-rename

Rename files easily
MIT License
692 stars 73 forks source link

Extension ignored if not the same as the src extension. #76

Closed sketchbuch closed 7 years ago

sketchbuch commented 7 years ago

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"

yocontra commented 7 years ago

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

gulp.src('somefile.less').pipe(rename('somefile.css')).pipe(gulp.dest('out'))
sketchbuch commented 7 years ago

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

yocontra commented 7 years ago

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

yocontra commented 7 years ago

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?

sketchbuch commented 7 years ago

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

creates the file "allcss"

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

Creates the same

sketchbuch commented 7 years ago

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

sketchbuch commented 7 years ago

And my package.json

https://pastebin.com/YJ4avZEV

sketchbuch commented 7 years ago

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.