instantaneous asset reload without nginx

pull/5761/head
Thibault Duplessis 2019-12-13 23:02:00 -06:00
parent e5880aba38
commit fc8891af28
4 changed files with 11 additions and 5 deletions

View File

@ -46,6 +46,10 @@ final class LilaComponents(ctx: ApplicationLoader.Context)
implicit def system = actorSystem
implicit def ws = wsClient
// dev assets
implicit def mimeTypes = fileMimeTypes
lazy val devAssetsController = wire[ExternalAssets]
lazy val boot: lila.app.EnvBoot = wire[lila.app.EnvBoot]
lazy val env: lila.app.Env = boot.env

View File

@ -15,7 +15,7 @@ import views._
final class Main(
env: Env,
prismicC: Prismic,
assetsC: Assets
assetsC: ExternalAssets
) extends LilaController(env) {
private lazy val blindForm = Form(
@ -188,5 +188,5 @@ Disallow: /games/export
}.fuccess
}
def devAsset(@silent v: String, file: String) = assetsC.at(file)
def devAsset(@silent v: String, path: String, file: String) = assetsC.at(path, file)
}

View File

@ -23,8 +23,10 @@ PlayKeys.playDefaultPort := 9663
PlayKeys.externalizeResources := false
// shorter prod classpath
scriptClasspath := Seq("*")
// give a fake assets dir to make sure they're not packaged
resourceDirectory in Assets := baseDirectory.value / "public-nothanks"
// don't make an assets jar
/* resourceDirectory in Assets := (sourceDirectory in Compile).value / "assets" */
PlayKeys.generateAssetsJar := false
// use akka-http for dev
PlayKeys.devSettings += "play.server.provider" -> "play.core.server.AkkaHttpServerProvider"

View File

@ -602,8 +602,8 @@ POST /jsmon/:event controllers.Main.jsmon(event: String)
GET /swag controllers.Main.movedPermanently(to: String = "https://shop.spreadshirt.com/lichess-org")
GET /assets/_$v<\w{6}>/*file controllers.Main.devAsset(v, file)
GET /assets/*file controllers.Assets.at(file)
GET /assets/_$v<\w{6}>/*file controllers.Main.devAsset(v, path="public", file)
GET /assets/*file controllers.ExternalAssets.at(path="public", file)
GET /robots.txt controllers.Main.robots