Skip to content
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

replace corrupts binary files #6

Closed
tcoopman opened this issue Mar 4, 2014 · 8 comments · Fixed by #9
Closed

replace corrupts binary files #6

tcoopman opened this issue Mar 4, 2014 · 8 comments · Fixed by #9

Comments

@tcoopman
Copy link
Contributor

tcoopman commented Mar 4, 2014

When gulp-replace runs on binary files, it corrupts them. gulp-replace should ignore binary files.

@nfroidure
Copy link

You could filter binary files with gulp-filter.

@tcoopman
Copy link
Contributor Author

tcoopman commented Mar 5, 2014

That's correct and I do that, but I still consider this a bug (gulp-replace should not corrupt files!)

@grahamb
Copy link

grahamb commented Mar 18, 2014

👍 for this - gulp-filter should only attempt to filter plain-text files, not binaries.

@lazd
Copy link
Owner

lazd commented Mar 18, 2014

@grahamb, you can use gulp-filter to stop gulp-replace from entering binary files. Did that approach not work for you?

@grahamb
Copy link

grahamb commented Mar 18, 2014

It does, but unless I'm mis-understanding how gulp-filter works, I have to filter by a glob (e.g. a filename), not file name. So, right now I've got var filter = gulpFilter(['!**/*.jar', '!**/*.png']);. If I (or someone else, or some other automated process) adds a .jpg file to the repo, then I've got to manually filter that as well.

I'd love to be disabused of this notion if I'm wrong.

@grahamb
Copy link

grahamb commented Mar 18, 2014

It's worth noting that ant (which hilariously is what I'm in the process of converting from) also has the same problem; if you use the ant copy task with a filter (ant-speak for replacing strings in a file with values from a java .properties file) it also corrupts the binaries. You have to do similar acrobatics (copy the files you want to filter first, excluding things with certain extensions, then copy the rest, without using a filter). I was hoping we'd advanced a bit more beyond that in the intervening 14 years 😉

@tcoopman
Copy link
Contributor Author

I believe that it should be possible to embed something like this: https://github.com/bevry/istextorbinary ?

@nfroidure
Copy link

the @tcoopman approach could do the trick, but, it should be behind an option since it could slows down the plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants