2011年11月28日月曜日

Load the JQuery Library via CDN with Grails Resources Plugin

Grails version
2.0.0.RC1
Resources Plugin version
1.1.1

You can use the jquery library on existing CDN networks with Grails Resources Plugin in this way.

// grails-app/conf/XXResources.groovy
modules = {
    // Defines JQuery's CDN network
    overrides {
        def jqueryVersion = org.codehaus.groovy.grails.plugins.jquery.JQueryConfig.SHIPPED_VERSION
        'jquery' {
            resource id:'js',
                     linkOverride:"http://ajax.googleapis.com/ajax/libs/jquery/${jqueryVersion}/jquery.min.js"
        }
    }
}

Note: The resources plugin load a resource via 'linkOverride' url only when it is not in debugging mode.
see also: Grails Resources Plugin: Debbugging

0 件のコメント:

コメントを投稿