jamesknelson / gulp-rev-replace

Rewrite occurences of filenames which have been renamed by gulp-rev
MIT License
389 stars 62 forks source link

Crash on large set of files that need modified #12

Open AlexRiedler opened 10 years ago

AlexRiedler commented 10 years ago

Due to caching of files (and their contents) it has to contain the entire streams of all the files that will need to be replaced; This results sometimes in building up a large amount of memory which sometimes makes the process quit for stack-overflow style reasons.

I am not sure if there is a good way to fix this (considering you would need all rev'd stream separate from the replacement stream; just an idea though).

Maybe gulp-rev-replace should take two streams as input, and product the modified streams as output instead? or support both?

jamesknelson commented 10 years ago

I'm not really sure how to go about fixing this. I'm thinking that if you have that many files running through gulp-rev-replace, it might be worth rethinking how your gulpfile is structured?

AlexRiedler commented 10 years ago

@jamesknelson its actually a little more interesting then that; rev() requires the file to be read (to compute the hash)... so your actually caching the entire file's contents as well (and if you have a lot of large images for instance).

jamesknelson commented 10 years ago

Ah I see, that kind of makes sense then. I'd be happy to merge a request if you can fix the issue, although seeing I'm not having the problem myself, it would be rather difficult to test.