Search code examples
playframeworkwebjars

Change the folder that WebJars are put in


I'm using Play with WebJars which is working great but I'd like to change the directory where the WebJar dependencies get put. At the moment they are all put in assets/lib.

I it possible to change this location in build.sbt or something similar?


Solution

  • If you want to change the URL that the assets are accessed with then you can change your routes, like:

    GET   /webjars/*file   controllers.Assets.versioned(path="/public/lib", file: Asset)
    

    If you want to change the dir they are stored in you can try to set webModulesLib in your build.sbt to a different dir. You can see that setting in the sbt-web plugin that extracts the WebJars:

    https://github.com/sbt/sbt-web/blob/master/src/main/scala/com/typesafe/sbt/web/SbtWeb.scala#L37