Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A Grails resource plugin which provides javascript minification via. Uglify2
Groovy
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
grails-app
src/groovy/org/grails/plugin/resource/minified/js/uglify
test/unit/org/grails/plugins/resource/minified/js/uglify
.gitignore
README.md
UglifyJsMinifiedResourcesGrailsPlugin.groovy
application.properties

README.md

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 is available from the Grails Plugin repository

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
}

License

UglifyJS is licensed under the BSD license.

Something went wrong with that request. Please try again.