Search code examples
jquerygrailsassetspipeline

grails 2.4 jquery path


I have the following config in BuildConfig file.

    // plugins for the compile step
    compile ":scaffolding:2.1.0"
    compile ':cache:1.1.7'
    compile ":asset-pipeline:1.9.7"
    runtime ":jquery:1.11.1"
    compile ":jquery-ui:1.10.4"
    runtime ':twitter-bootstrap:3.3.2'

No resources plugin

and application.js

//= require jquery
//= require_tree .
//= require_self
//= require bootstrap

and application.css

*= require main
*= require mobile
*= require_self
*= require bootstrap

still, when i load the page i dont see the right path for jquery and hence jquery is not loaded. what am i missing.

when i did a view source this is what i see

<script src="/appName/js/jquery/jquery-1.11.1.js" type="text/javascript" library="jquery"></script>

Solution

  • So, to conclude:

    • Make sure you do not have any harcoded <script> element in your .gsp pointing to jquery.
    • If you upgraded from Grails 2.3, make sure you remove all lingering <g:javascript library='jquery'/> et <r:layoutResources/> statements.
    • Make sure you have an <asset:javascript src="application.js"/> statement in your layout .gsp
    • Make sure you do not have the jquery lib in web-app/js

    If you do not bundle your resources, you should get the following entries in the HTML source view:

    <script src="/APPNAME/assets/jquery/jquery-1.11.1.js?compile=false" type="text/javascript" ></script>
    <script src="/APPNAME/assets/jquery.js?compile=false" type="text/javascript" ></script>