grails-core icon indicating copy to clipboard operation
grails-core copied to clipboard

ES6 Literal Template Support inside GSP Pages

Open codeconsole opened this issue 7 months ago • 0 comments

The following will not work inside a gsp and will throw an exception.

<script type="text/javascript">
    const name = 'Bob';
    console.log(`Hello ${name}`)
</script>

Workaround:

<script type="text/javascript">
    const name = 'Bob';
    console.log(${raw('`Hello ${name}`')})
</script>

but a workaround shouldn't be necessary if 1. currently in a block AND inside ``.

codeconsole avatar May 22 '25 22:05 codeconsole