Zipped Resources

  • Authors: Marc Palmer
6 votes

10% of Grails users

Dependency:
runtime ":zipped-resources:1.0"

 Documentation  Source  Issues

Summary

Integrates with Grails' resources framework to automatically gzip static files

Description

This plugin leverages the Resources plugin to apply gzip encoding to static resources. It works well with the cached-resources plugin to add gzipping to the automatically uniquely-named and browser-cached resources.

By default, in this alpha, all resources handled by the resources plugin will be gzipped (e.g. including images).

There is no configuration required. This plugin applies the "zip" mapping to resources, so you can suppress it by declaring a resource with nozip:true - see the resources plugin for details of how to declare resources.

This plugin and the resources plugin framework are experimental alphas and WILL change before 1.0 final

Usage

Just install: grails install-plugin zipped-resources

See the documentation for the resources plugin for how to define your resources or how to link to them with <r:resourceLink/> and <r:resource/>

Details

This applies the "zip" mapping which gzips the file, coping the cached file on the server to a new file with .gz extension. It always sends zipped content at this time, without checking the Accepts header (all modern browsers should be fine with this).

It sets the Transfer-Encoding header to "gzip"

Commercial Support

Commercial support is available for this and other Grailsrocks plugins.