Cached Resources
11% of Grails users
Dependency :
runtime ":cached-resources:1.0"
Summary
Provides a "hash and cache" mapper for the resources framework, automatically creating safe unique filenames for your resources and setting them to eternally cache in the browser.
Description
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.See the documentation for the resources plugin for how to define your resources.
Usage
Just install:grails install-plugin cached-resources
Commercial Support
Commercial support is available for this and other Grailsrocks plugins.Resource mappers
This plugin adds the resource mapper called hashandcache which you can include/exclude based on URIs or individual resources using normal Resources configuration mechanisms.Configuration
There are mapper-specific Config values supported:- flatten - Controls whether or not the mapper should flatten directories after creating the unique file names
- shorten - Controls whether or not the mapper should shorten the generated hashed file names using base62 encoding (yes that's 62 not 64).