Play 㧠Scala.js ã使ã
Play meetup ã§ã¯ Play ã Scala ã®ãã¬ã¼ã ã¯ã¼ã¯ã®æ´å²ã¿ãããªè©±ããã¦ãã¾ããããæ¬å½ã¯ãã®ãã¿ã§ LT ãããã¤ããã§ããã諸äºæ ã«ããã£ã¦ãã¤ã§ãã
ã㦠Play 㧠Scala.js ããµãã¼ãããããã£ã¦è©±ã¯å°ãåããããã¾ãããä»ã®ã¨ããã¾ã é²å±ã¯ãªãããã§ãã
Add buildin ScalaJs support · Issue #2321 · playframework/playframework
ãã ããã¡ãã sbt ããããã°ä¸ç·ã«ä½¿ããã¨ãå¯è½ã§ãã
åç´ã« optimizeJS ãã¦åºåããã js ã Play ã® public/javascripts ãã©ã«ãã«ã³ãã¼ããã¨ãã
lazy val copyJS = Command.command("copyJS") { (state) => scala.sys.process.Process(List("cp", "js/target/scala-2.10/scala-js-slide-js-opt.js", "server/public/javascripts/")).! state }
ã¡ãã£ã¨ãã£ã¤ãæããã¾ããåé¡ãªã使ãã¾ãã
ã§ãã¾ãããã¡ãã£ã¨ã¾ã¨ããªæ¹æ³ã¯ãå ¬å¼ãµã¤ããããªã³ã¯è²¼ããã¦ã¾ããã ããã clone ãããè¨å®ãã¯ãã°OKã§ãã
git clone [email protected]:vmunier/play-with-scalajs-example.git
ãã®ããã¸ã§ã¯ãã§ã¯ Scala.js ã®ããã¸ã§ã¯ãã scalajs ã¨ãããµãããã¸ã§ã¯ããPlay ã¢ããªã scalajvm ã¨ãããµãããã¸ã§ã¯ããããã«ãã®ä¸¡æ¹ã§å ±æãããã³ã¼ãã shared ã¨ãããµãããã¸ã§ã¯ãã«ãªã£ã¦ãã¾ãã
âââ README.md âââ project â  âââ Build.scala â  âââ build.properties â  âââ plugins.sbt â  âââ project â  âââ target âââ scala â  âââ shared â  âââ target âââ scalajs â  âââ src â  âââ target âââ scalajvm âââ app âââ conf âââ logs âââ public âââ target âââ test
ãã®ããæ¹ã«ã¤ãã¦ã¯ pab_tech ãããæ¸ãã¦ãã®ã§ãã¡ããè¦ã¦ãã ããã
Scala.jsã¨JVMã®ä¸¡å¯¾å¿ã³ã¼ãã¨Scala.jsã®ãã¹ãã®æ¸ãæ¹ | PABlog
ã§ãPlay ã¨ä½¿ãããã® build.sbt è¨å®ã®ä¸å¿ã¯ä»¥ä¸ã®é¨åã§ãã Scala.js ã®åºåå ã Play ã® public/javascripts ã«ãã¦ãã¾ããããã« dependsOn ã使ã£ã¦ Play ã®ã¢ããªãã³ã³ãã¤ã«ããã¨ãã« Scala.js ã®ããã¸ã§ã¯ãã®ã³ã³ãã¤ã«ãèµ°ãããããã«ãã¦ãã¾ããdist ã³ãã³ãã使ã£ãã¨ãã«ã¯ optimize ãè¡ãããã«ãªã£ã¦ãã¾ãã
lazy val scalajvmSettings = play.Project.playScalaSettings ++ Seq( scalajsOutputDir := (crossTarget in Compile).value / "classes" / "public" / "javascripts", compile in Compile <<= (compile in Compile) dependsOn (preoptimizeJS in (scalajs, Compile)), dist <<= dist dependsOn (optimizeJS in (scalajs, Compile)), ) ++ ( // ask scalajs project to put its outputs in scalajsOutputDir Seq(packageExternalDepsJS, packageInternalDepsJS, packageExportedProductsJS, preoptimizeJS, optimizeJS) map { packageJSKey => crossTarget in (scalajs, Compile, packageJSKey) := scalajsOutputDir.value } )
ããã§ãPlay ã§ã Scala.js ã使ããããã«ãªãã¾ãããã£ãã¼ï¼ã³ã³ãã¤ã«æéãããã«ä¼¸ã³ã¾ããï¼