jamesfredley commented on issue #14204:
URL: https://github.com/apache/grails-core/issues/14204#issuecomment-3210943098

   I agree  this should guide users towards the asset pipeline tags instead.  
   
   Updated links:
   
   https://docs.grails.org/snapshot/ref/Tags%20-%20GSP/javascript.html
   
https://github.com/apache/grails-core/blob/HEAD/grails-doc/src/en/ref/Tags%20-%20GSP/javascript.adoc
   
   https://docs.grails.org/snapshot/guide/theWebLayer.html#layouts
   
https://github.com/apache/grails-core/blob/HEAD/grails-doc/src/en/guide/theWebLayer/gsp/layouts.adoc
   
   I don't see a good example on the sitemesh layouts section for adding JS at 
the end of the body, we should add something like the following and can link to 
in from https://docs.grails.org/snapshot/ref/Tags%20-%20GSP/javascript.html 
replacing the <r:script> paragraph.
   
   **views/layouts/main.gsp**
   ```
   <!DOCTYPE html>
   <html lang="en">
   <head>
       <title><g:layoutTitle default="${message(code: 'application.name')}" 
/></title>
       <asset:stylesheet src="custom.css" type="text/css"/>
       <g:layoutHead/>
   </head>
   
   <body>
   
   <g:layoutBody/>
   
   <asset:javascript src="custom.js"/>
   <g:pageProperty name="page.endOfBody" />
   </body>
   </html>
   ```
   
   **views/index.html**
   ```
   <!DOCTYPE html>
   <html lang="en">
   <head>
       <meta name="layout" content="main">
       <title>Homepage</title>
   </head>
   
   <body>
   <div>
        <p>homepage body content</p>
   </div>
   <content tag="endOfBody">
   <script>
      alert('hello')
   </script>
   </content>
   </body>
   </html>
   ```
   
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@grails.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to