Skip to content

Instantly share code, notes, and snippets.

@drcharris
Last active January 11, 2017 18:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save drcharris/2e3518b212adfa1b6a7f to your computer and use it in GitHub Desktop.
Save drcharris/2e3518b212adfa1b6a7f to your computer and use it in GitHub Desktop.
DEPRECATED - see https://gist.github.com/cessationoftime/b304c13f810f9d52e32fbf6c778af3d9 for updated version. Use different assets for different configurations with Play Framework
...
assets.path="/public"
...
package controllers
import play.api.Play
import Play.current
import play.api.mvc.Action
import play.api.mvc.AnyContent
object ConfigurableAssets extends AssetsBuilder {
private val assetsPath = Play.configuration.getString("assets.path").getOrElse("/public")
def at(file:String): Action[AnyContent] = {
at(assetsPath, file)
}
}
...
assets.path="/dist"
...
#static files
GET /public/*file controllers.ConfigurableAssets.at(file)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment