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

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -