Grails 3.0 How to use Javascript in GSP's? -
the documentation says, <r:script> right way this, part of resources plugin, not available in grails 3.0, think in single gsp right way use javascript @ end of <body>
<g:javascript>-tag.
is there better way this?
you can use <asset:javascript src="example.js" />
@ bottom of gsp file.
however, sitemesh inserts body <g:layoutbody />
in layout gsp, there end being other tags between <script>
, end of <body>
. cleaner create separate layout gsp.
also, sure not include example.js
in application.js
or else special js file end on every page default. 1 option create assets/javascripts/public
folder else.
grails-app/assets/javascripts/application.js
//= require_tree ./public
Comments
Post a Comment