-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Output filename different than input #34
Comments
This seems like a good case for gulp-rename. gulp.dest is specifically for folders - we used to have a .file output but that was removed Proposed: gulp.task('minifycss', function() {
gulp.src('./dist/assets/css/main.css')
.pipe(minifycss())
.pipe(rename('main.min.css'))
.pipe(gulp.dest('./dist/assets/css/'));
}); This also gives me an idea for a gulp-extrename plugin that changes the extension of any file passed through |
@hparra Would you mind renaming that to gulp-spawn? I was planning on using gulp-cli to split out that section of code soon For the rename plugin you could have a few different ways. String for simple rename, object like Other plugins could use this rename plugin to rename files, change file extensions, etc. by piping their existing output through it |
@contra Yeah. That's exactly the way it should work - takes hash of helpful params like "extension", "prefix", "suffix", or a function to roll your own deal, e.g. regex, etc. RE: gulp-cli. I unpublished it. You should probably go ahead and sit on entry. |
@hparra I got chastised by isaacs for camping a plugin before while I was working on the code. I'll just hope nobody is a dick and takes it. |
Also @hparra feel free to make gulp-rename yourself if you want! The idea is pretty straightforward and there is already code for renaming extensions and whatnot in gulp-util |
Putting out a bounty of $5 to anyone who wants to make gulp-rename |
Sorry, I was going to do this since I already did that Proposal: it accepts a string for explicit rename, or a hash with options for common operations (prefix, suffix, extension) relative to the original filename, or a custom function. |
@hparra Exactly what I had in mind |
@contra Me too. Will get to it later tonight. |
@markgoodyear Released as gulp-rename. @contra I guess you can close this! |
@hparra Tested, and works great. I use the same method for minifying JS, so the |
Nice! @hparra DM me your gmail so I can send you a wallet payment |
This really should be built-in functionality... It is extremely common to output files in the format |
No, it should not, use gulp-rename. |
Would it be possible to specify a different output file than the source file? For example, my project requires specifying a
main.css
file, along with a minified version,main.min.css
.Obviously the above doesn't work — it just creates a folder called
main.min.css
then puts the output file inside, but something like the above would be great.Cheers,
Mark
The text was updated successfully, but these errors were encountered: