Search code examples
javascriptgrailsreload

Grails javascript file reload


I'm developing a single page app and this requires a lot of javascript code editing. Unfortunately looks like grails is caching the javascript files and i can't see the effect of the modifications I made until I'm not running a clean command followed by a restart (it is 100% not a browser cache problem).

I'm using the resource plugin to get my JS files but I tried with and I get the same result, no matter were the files are placed (web-app/js or web-app/assets/js).

The only way to see the modifications in realtime is to place the code in a .gsp file but I don't like this solution. Is there any setting to enable the hot reload?

I'm using grails 2.2.2, win7


Solution

  • If you're using resources plugin (as it's the default in grails 2 I think), just add the following to the end of the url and you will se the changes:

    ?_debugResources=y
    

    for example:

    http://localhost:8080/myapp/main?_debugResources=y
    

    Check the official documentation for other options: http://grails-plugins.github.io/grails-resources/guide/8.%20Debugging.html