Oleg
Oleg

Reputation: 3210

Working with two assets directories in Scala Play framework 2.4

I am trying to use 2 public assets routes. One for development version and the other one for production version. But this routes config does not work: for both pathes I receive 404 error.

GET  /assets/*file        controllers.Assets.at(path="/public", file)
GET  /us/*file             controllers.Assets.at(path="/us", file)

For the old play 2.0 I have to config extra assets directories in build.sbt

playAssetsDirectories <+= baseDirectory / "us"

to publish all files in copiled target. But now this property does not exists.

Upvotes: 2

Views: 312

Answers (1)

Daniel Olszewski
Daniel Olszewski

Reputation: 14401

This has been changed in Play 2.3 and there's a migration guide for this issue. Instead:

playAssetsDirectories <+= baseDirectory / "us"

you should now use the following construction:

unmanagedResourceDirectories in Assets += baseDirectory.value / "us"

However, this will copy the content of us directory into public in the target distribution, so make sure you don't override something important. You can find more details in the given docs.

Upvotes: 1

Related Questions