Closed rubinsh closed 9 years ago
Thanks for the PR! I'm happy with the random value feature addition, however it would be great if you could implement this a little differently.
Please use crypto.pseudoRandomBytes(size[, callback])
or crypto.randomBytes(size[, callback])
to generate the random value rather than the sha sum of the date. These will give you good enough random values and reduce the chance of collision.
Thanks. I've updated the implementation to use crypto.randomBytes. Also - I removed the need of the external sha1 npm package as I found that crypto includes sha1 inside it.
One more thing - I added an MIT license to the package.json - I hope you don't mind :-)
I'm fine with the implementation and the MIT licence. One change; can we name the optional parameter random
rather than useSha1
?
It might confuse some people as to the purpose of the parameter otherwise. With that changed I'll be happy to merge.
Thanks for your patience and efforts :)
Done - the code was updated. To be honest I wasn't happy with the "useSha1" naming to begin with, but I could not think on something else :-)
Hi,
I had a problem that many times gulp-cachebust generated the same file names (checksums) for my files, even when I was actually doing code changes. I added an option to just use random strings generated with sha1. This makes sure that each time you run gulp-cachebust it will generate different file names. The idea for using sha1 instead of crypto was taken from here: http://stackoverflow.com/a/13254774/203292
This option is disabled by default.
Thanks.