0

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.

alex_c
  • 2,058
  • 2
  • 26
  • 34

1 Answers1

1

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

Gelin Luo
  • 14,035
  • 27
  • 86
  • 139
  • Thank you! Works like a charm, for the most part. I ran into a problem with LESS, however - when greenscript.router.mapping=true, resource paths have an extra "public" in them in the compiled CSS file. For example instead of "url(/project/public/stylesheets/../images/logo.png)" the path becomes "url(/project/public/public/stylesheets/../images/logo.png)". Is this something you've run into before? – alex_c Oct 24 '12 at 23:03