Search code examples
playframeworkgreenscript

Can / does Greenscript change the file names it generates when contents change?


We're using Greenscript 1.2.8b on Play 1.2.5 to minify and combine JavaScript and CSS files. I was investigating some caching issues we ran into and noticed the file names Greenscript generates don't seem to change when we deploy a new version.

Is there any way we can force it to generate a new file name for the combined JS or CSS file when the contents change?

Edit: I accepted the answer below, because it should work for most people. However, it was messing up paths in my CSS, so I ended up with something slightly different. I added the following line to my application.conf:

greenscript.url.minimized=/gs/VERSION

And in my build script I replace VERSION with the latest version number from source control.


Solution

  • according to https://groups.google.com/forum/#!msg/play-framework/1saij-OP1go/grzGIoBXSTAJ, you can try the following approach:

    1. add a file named ".version" to your project home, update the file each time you deploy your project changes
    2. Add the following line to the routes file:

      GET /public/%{out.write(play.getVirtualFile(".version").contentAsString())}%/ staticDir:public

    3. Add the following configuration to application.conf:

      greenscript.router.mapping=true