How to include jquery.js in Grails?

后端 未结 10 2123
北海茫月
北海茫月 2021-02-05 06:50

I have a Grails 2.0.0 project that was created using grails create-app. In my HTML and GSP files, I\'m trying to include jquery.js. I\'ve tried all of

10条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-05 07:13

    In grails 2.x you can also do:

    grails.resources.modules = {
        core {
            dependsOn 'jquery, jquery-ui'
        }
    }
    

    in Config.groovy

    Then in your GSP simply place the following in your HEAD element:

    
    

    The advantage is you can specify other CSS/JS files to depend on, makes it nice and clean in the GSP. This is also where you can override the versions of jQuery/jQuery-UI.

提交回复
热议问题