Closed soslan closed 9 years ago
You could just use https://github.com/hparra/gulp-rename.
I see in gulp-rename, basename means filename without the suffix, while here, basename is effectively the whole filename.
@kevva You still have to gulp.dest() it. Handling names in gulp.dest() is more concise, IMO.
In node, basename is both with and without extension. See https://nodejs.org/api/path.html#path_path_basename_p_ext
I'm not sure about adding this.
:+1:
@phated But to do so with the Node.js API you need to know the extension, which means you'll end up with something like this: path.basename(filepath, path.extname(filepath))
which is very verbose. I wish the Node.js API had a stem method too.
@sindresorhus okay, what is the best name for this? The linked document doesn't mention "stem"
PHP uses filename
for basename
without extension.
Looks like C++ calls it a stem
So does python and rust. Probably stick with stem then.
I prefer stem too.
@soslan This looks to be failing the updated linting/jscs rules. Can you update this PR? Everything else looks good.
@phated Done. I should have not synced it with upstream though.
Published as 1.1.0 - Thanks for this feature!
I want this in gulp ^3.9.0. Can we merge this into a vinyl v0.* release? Or update gulp 3 to use vinyl ^1.1.0?
I'd submit a pull request, but I don't see a vinyl v0.* branch - is vinyl v0.* no longer maintained or supported?
@gilly3 nope, I recommend you just depend directly on a new version of vinyl-fs
Hello! This patch adds
stem
property toFile
for getting and setting filename part preceding the last period (sometimes also called basename[1]).[1] https://www.gnu.org/software/make/manual/html_node/File-Name-Functions.html