-
-
Notifications
You must be signed in to change notification settings - Fork 156
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
Overwriting on a per-file basis? #68
Comments
Not 100% sure on this one. Early in the AM let me chew on it for a bit. |
Seems strange to have a file determine the flag behavior, especially because you would need some custom plugin to attach the overwrite property. Can't this be achieved through use of gulp-if or gulp-filter? |
maybe all of the options on dest should be either value or function just to normalize it, then you can do whatever you want in your function ie gulp.dest(folder, {overwrite: function(file){ }} will take a PR for this, most of the options already function this way |
allow a function to be used as value for the overwrite option - closes #68
allow a function to be used as value for the overwrite option - closes #68
I have been working on a peculiar case: a client has developers working on different editors, and no-one bothered setting their editors / IDEs for tabs and spaces. That client also doesn't really care about style guides and as a result they introduced jsbeautify in their building process: source files are overwritten with their prettified contents. This is of course not editor friendly (causes files to be reloaded, or editors to prompt for reloads) but this is how that client does it.
The build process has been recently converted to Gulp (using Gulp 4), and to try to make the process more editor-friendly, I introduced a piece of pipeline which prettifies file contents, compare the prettified version with its original and only copy if different.
The issue I have is that I bypass gulp.dest() and use fs.writeFile() instead inside that piece of pipeline. I would prefer if I had a piece of pipeline which would prettify and set an
overwrite
flag to true if different, and then pass it to gulp.dest().https://github.com/wearefractal/vinyl-fs/blob/master/lib/prepareWrite.js#L15 could become:
Should I go ahead with a pull request?
The text was updated successfully, but these errors were encountered: