user852518
user852518

Reputation: 501

prevent double include of jquery

I'm using the jquery-ui and resources plugins. In my config.groovy, I have

grails.views.javascript.library="jquery"

and some modules

grails.resources.modules = {
  cluetip {
     dependsOn 'jquery-ui'
     resource url:'css/jquery.cluetip.css'
     resource url:'js/jquery.cluetip.min.js'
  }
} 

This works all fine, except that the generated HTML contains a double include of jquery

<script src="/static/plugins/jquery-1.6.1.1/js/jquery/jquery-1.6.1.min.js" type="text/javascript" ></script>
[...]
<script type="text/javascript" src="/plugins/jquery-1.6.1.1/js/jquery/jquery-1.6.1.min.js"></script>

How can I prevent this?

Forgot to mention: I'm using grails 1.3.7

Edit

In my layout I have

<r:layoutResources/>
<g:javascript library="jquery" plugin="jquery"/>

The last line is the problem and must be removed - Thanks to Stefan. I marked his answer as correct, but please read the comments.

Christian

Upvotes: 2

Views: 755

Answers (1)

Stefan Armbruster
Stefan Armbruster

Reputation: 39925

IMHO the best way to deal with this is using the Grails Resources plugin.

Upvotes: 1

Related Questions