Manually add jquery and jquery-ui to grails project -


i've been coding in grails couple months. added page through main.gsp file following:

<g:javascript library="jquery"/> <r:require module="jquery-ui"/> 

the jquery , jquery-ui plugins have been working fine dialogs, sorting, etc, want add tabs widget pages , versions of jquery , jquery-ui come plugins framework don't seem work them. when add sources directly page:

<script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script> 

everything works fine. i'm thinking of dumping plugins entirely , adding libs in manually.

what best way go doing this? put them in /js directory , modify applicationresources.groovy reference them, co-worker mentioned preferred adding them grails.resources.modules section of config.groovy. know best way accomplish be.

i have following in config.groovy:

grails.resources.modules = {  overrides {     'jquery-theme' {         resource id: 'theme', url: '/css/smoothness/jquery-ui-1.10.0.custom.css'     } } 

do need move somewhere else or change if remove plugins , manage libs myself?

the 2 options valid. can work config.groovy or applicationresources.groovy.

before removing plugins suggest check if version need exists. plugin portal of grails.org show latest version. tried here , :jquery:1.9.1 exists :jquery-ui:1.10 not.

manually declare resources

so, if need, can declare resources jquery , jquery ui. remove plugins , overrides, , add configs. files must go in js and/or css folders.

you can check environment , change minified version if needed. example:

//use minified version in production def minified = grailsutil.isdevelopmentenv() ? "" : ".min"  modules = {   jquery {     resource url: "/js/jquery-1.9.1${minified}.js"   }   'jquery-ui' {     resource url: "/js/ui/1.10.2/jquery-ui${minified}.js"     resource url: "/css/smoothness/jquery-ui-1.10.0.custom${minified}.css"   } } 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -