Grails
  1. Grails
  2. GRAILS-5163

Add "debug mode" for templates; output template name in output as html comment

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.3.5
    • Component/s: None
    • Labels:
      None

      Description

      In large grails projects, it's hard to find the template that actually renders the html.

      Add a debug mode to render taglib so that it would output template name as html comments:

      <!-- begin XX render template "_sometemplate.gsp" -->
      content from template
      <!-- end XX render template "_sometemplate.gsp" -->

      there could be a identifier to match which begin and end comments are pairs.

      debug mode should be configurable in Config.groovy .

        Activity

        Hide
        Lari Hotari added a comment -

        Implemented in this commit: http://github.com/grails/grails-core/commit/8c5a3064696bed760e6027ac605e7b74296b5c43

        Usage is simple: append "?debugTemplates" or "&debugTemplates" to the url and view the source of the result in your browser. There will be debug information about gsp templates used to render the page as html comments.
        example:
        <!-- GSP #2 START template: /home/lari/sampleapp/grails-app/views/_carousel.gsp precompiled: false lastmodified: 22.6.2010 10:45 -->
        .
        .
        .
        <!-- GSP #2 END template: /home/lari/sampleapp/grails-app/views/_carousel.gsp rendering time: 115 ms -->

        Each block has a unique id (counter) inside the page so that you can find the start & end of each template call.

        "debugTemplates" is restricted to development mode. It won't work in production.

        Show
        Lari Hotari added a comment - Implemented in this commit: http://github.com/grails/grails-core/commit/8c5a3064696bed760e6027ac605e7b74296b5c43 Usage is simple: append "?debugTemplates" or "&debugTemplates" to the url and view the source of the result in your browser. There will be debug information about gsp templates used to render the page as html comments. example: <!-- GSP #2 START template: /home/lari/sampleapp/grails-app/views/_carousel.gsp precompiled: false lastmodified: 22.6.2010 10:45 --> . . . <!-- GSP #2 END template: /home/lari/sampleapp/grails-app/views/_carousel.gsp rendering time: 115 ms --> Each block has a unique id (counter) inside the page so that you can find the start & end of each template call. "debugTemplates" is restricted to development mode. It won't work in production.
        Show
        Lari Hotari added a comment - Documentation added: http://github.com/grails/grails-doc/commit/c14f28ef89ee7a78b6d4c07909a0ae7cd6624cba

          People

          • Assignee:
            Lari Hotari
            Reporter:
            Lari Hotari
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development