postcss / postcss-url

PostCSS plugin to rebase url(), inline or copy asset.
MIT License
377 stars 59 forks source link

support crypto hash function methods #91

Closed clydin closed 7 years ago

clydin commented 7 years ago

This simplifies use of other common hashing methods.

sergcen commented 7 years ago

i removed crypto because xxhash more than 20x faster, with same quality if you want to use crypto, use custom hash method

useHash: true,
hashOptions: { method: cryptoHashFn }
clydin commented 7 years ago

I could potentially see that the use of standard hash functions would be a very common use case (as it is for myself). Especially when using postcss-URL in a larger build pipeline (with webpack for instance) where the use of standard hash functions are already in use and/or may be mandated by project requirements.

The speed improvement is unfortunately of limited utility for the typical use case wherein the processing is conducted only during a build and usually on a high performance development system or server. Web optimized assets are also typically fairly small in size. If the hashing were to occur on the client or involved in a realtime scenario, for instance, the need for the speed improvement would definitely be more warranted.

i completely agree with the removal of the hard coded hashing choice from the previous version. I had a similar PR planned for the previous version that allowed easy customization of the hashing method as well.

Personally, I'm also a minimalist when it comes to package dependencies and the use of crypto requires no additions.

With that said, I defer to your judgement as the project maintainer and thank you for the opportunity to contribute to an incredibly useful tool.