sindresorhus / gulp-rev

Static asset revisioning by appending content hash to filenames: `unicorn.css` → `unicorn-d41d8cd98f.css`
MIT License
1.54k stars 218 forks source link

Question: Is it possible to hash based only on the checksum of the file? #95

Closed adjavaherian closed 9 years ago

adjavaherian commented 9 years ago

I just deployed two clusters and had each one build and rev its own products before serving. I'm getting a different hash for each product even though they are the same checksum. So, I suspect that utime or random seeds are involved in computing the hash? It doesn't look like you can specify how you want to compute the hash in the options. Of course, one solution is to just build locally and check that into repo, but it might be cool to have this option. Thoughts?

bobthecow commented 9 years ago

Nope. It's literally just an md5 of the file contents:

https://github.com/sindresorhus/gulp-rev/blob/master/index.js#L49

Are you concatenating files? If you're on a filesystem that doesn't guarantee directory order, they could be being concatenated in a different order?

adjavaherian commented 9 years ago

Thanks Bob, I just noticed that too. Its just using MD5 from the crypto package. I think you're right about the directory order. They're on Ubuntu locally and CentOS remote. Ubuntu is using ext4. No worries, I should be building these products on Jenkins anyway, so there is only one source of truth. Thanks.