ember-cli / broccoli-asset-rev

Broccoli plugin to add fingerprint checksums and CDN URLs to your assets
MIT License
87 stars 84 forks source link

Feature request: fingerprint everything, allow excludes #88

Open buschtoens opened 8 years ago

buschtoens commented 8 years ago

FINGERPRINT ALL THE FILES

Personally, I think it's more useful to fingerprint all files regardless of their extension and only exclude a few. It would be great if that mode was supported by setting extensions: null.

Here's why:

When I deploy my static assets I basically want them cached forever. That's why I configured my CDN (CloudFlare) to instruct the browsers to cache all files from my https://assets.example.com/ domain for 1 year. The problem with this is, that there are some files (like icon fonts) that don't get fingerprinted because of their file extension, but still get these caching rules.

This is problematic when these files are regenerated and change. Because they were not fingerprinted, all browsers retain the old version and don't download the new one.

Of course I could fix this by adding .woff and all other web font output extensions to the extensions array.

However, this is tedious and paves the way for unexpected caching errors. Especially when I introduce additional formats like .svg or .webm, etc. Whenever I add a new static file format, I'd have to make sure it's on the list.

Therefore my suggestion: Setting extensions: null disables the filtering. This would not break backwards compatibility as far as I can see. I'd make a PR, if you're okay with this. :smiley:

One step further (but breaking backwards compatibility): fingerprint all files by default, except for some sensible exclusions, like /index.html and /favicon.ico, even though the latter one is debatable. The old behaviour would be opt-in by setting extensions to an array.

Was there a specific reason to not fingerprint all files right away? Performance maybe? If peformance is a problem, we could introduce a new setting maxSize, and files would be filtered based on that.

rickharrison commented 8 years ago

I'd personally prefer to do something like extensions: ['*'] or something similar.

shripathee commented 7 years ago

What's the current status on this?