bolinfest / plovr

plovr: a Closure build tool
78 stars 49 forks source link

Aggressive cache #128

Closed silverlyra closed 7 years ago

silverlyra commented 7 years ago

We use the RAW mode for development, and in our codebase, Plovr adds so many script tags to our pages that even fetching them over localhost can take more than 10 seconds. 😒

This adds a new config option to set a long-lived Expires and max-age to files that can produce an ETag, and includes the tag as a cache-busting query parameter in the URI's served from /compile. Unchanged files are served directly from the browser's cache without consulting Plovr. ✨

This doesn't work on .soy files yet; I'd appreciate any thoughts you have on the subject. :)

silverlyra commented 7 years ago

thanks for the quick review! 🎉

is there ever a reason that you wouldn't want to do this? i guess the main use case i can think of is that if you know the including html page is fresh, then you can should use the urls with _tag params, but if you think the including html page might be cached, you should let the normal etag negotiation kick in.

that's a plausible case – mostly I didn't want to land a substantial behavior change which wasn't opt-in.

PTAL. we're also still using Plovr v6. this patch applies cleanly to the v6.0.0 tag; I'd really appreciate a v6.0 branch I can also submit this to and a v6.1 release if you land it.

thanks again!

hi from Medium

nicks commented 7 years ago

y'all are goofs