Uglify JS Minified Resources Plugin

1 vote
Dependency:
compile ":uglify-js-minified-resources:0.1.1"

 Documentation  Source  Issues

Summary

Works with the resources plugin to minify javascript resource using Uglify2.

Installation

grails install-plugin uglify-js-minified-resources

Description

This is a Grails plugin which provides minification of javascript resources using Uglify2. It is dependent on the standard Grails Resources Plugin

Background

Due to the fact that the YUI Minified Resources Plugin has been deprecated, I thought it would be useful to create a new javascript minification plugin based on the Uglify2 project.

I made generous use of the coffeescript resources plugin for examples on how to use the Rhino library.

Usage

This plugin should automagically minify your javascript files if it is installed. There is no mandatory configuration required.

This plugin ignores javascript files which have an extension of *.min.js.

By default, bundles are ignored since the individual files are minified before getting bundled. To enable bundling, set the following in Config.groovy:

grails.resources.mappers.uglifyjs.forceBundleMinification = true

To disable javascript variable munging, set the following in Config.groovy:

grails.resources.mappers.uglifyjs.noMunge = true

To get info on compression, turn on info logging in Config.groovy:

log4j = {
    // info 'org.grails.plugin.resource' //all resources info logging
    // info 'org.grails.plugin.resource.minified.js.uglify' // just the uglify info
}