There are two asset directory, one is /ui/dist
and the other is /public
. I tried to write the routes like this:
GET /assets/*file controllers.Assets.at(path="/public", file)
GET /ui/*file controllers.Assets.at(path="/ui/dist", file)
But it will throws an error while compiling:
[error] Unspecified value parameter file.
[error] <link rel="stylesheet" media="screen" href="@routes.Assets.at("stylesheets/main.css")">
Does anyone have ideas about how to solve this...
Try creating a separate router object for each one:
and then in your routes:
I think what's happening in your attempt is that the reverse router is generating an object for your public routes, and then another one with the same name for the ui routes which overwrites the first (if anyone knows more precisely, please correct me.) The solution should be to name your asset classes differently, so the generated reverse routes likewise have different names (or, alternately, call them the same thing but put them in different packages.)
I found the key is to pass in another parameter to
routes.Assets.at
, the following is from the playframework Asset documentThen you will need to specify both parameters when using the reverse router: