Last updated by admin 1 year ago
Last updated by marcpalmer 1 month ago
This plugin leverages the Resources plugin to make static resources browser-cacheable with unique filenames based on their content. It works well together with
zipped-resources pluginThere is no application versioning required as this plugin uses a similar approach to "git". It hashes files and renames them to their hash. So when your resource file contents change, the file names automatically change - no more problems with stale JS or CSS content in your client browsers.
The result is that even if your application version changes between deployments, if some resources did not change in that release,
all your users will still be able to continue using their previous long-term cached file without reloading from your site.
It is zero-hassle static file caching.
Usage
Just install:
grails install-plugin cached-resources
See the documentation for the
resources plugin for how to define your resources.
Details
Each file is hashes using SHA-256. Using the resources plugin, it is able to rename the file and change the URL generated when your application links to the resource.
Then, when requests come in, it adds all the required caching headers to attempt "eternal" caching by intermediate caches and the client browser. It does this using the
cache-headers plugin.
Configuration
You may want to control which file types are hashed and cached, or exclude all hashing and caching in the development environment. For details see the configuration documentation for the
Resources plugin.
Last updated by admin 1 year ago
Last updated by admin 1 year ago