scala - Where is my compiled coffee script js file? -
i have play 2.5.x app , created file in following folder:
/app/assets/javascript/test.coffee
in master.scala.html have:
<script src="@routes.assets.versioned("javascripts/test.js")" type="text/javascript"></script>
my plugins.sbt has:
// web plugins addsbtplugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0") addsbtplugin("com.typesafe.sbt" % "sbt-less" % "1.1.0") addsbtplugin("com.typesafe.sbt" % "sbt-jshint" % "1.0.3") addsbtplugin("com.typesafe.sbt" % "sbt-rjs" % "1.0.7") addsbtplugin("com.typesafe.sbt" % "sbt-digest" % "1.1.0") addsbtplugin("com.typesafe.sbt" % "sbt-mocha" % "1.1.0") addsbtplugin("org.irundaia.sbt" % "sbt-sassify" % "1.4.2")
when run app doesn't create file in /public/javascript/test.js
folder.
trying navigate file file not found error:
http://localhost:9000/assets/javascripts/test.js
my routes has:
get /assets/*file controllers.assets.versioned(path="/public", file: asset)
how should working have never used before?
reference: https://www.playframework.com/documentation/2.5.x/assetscoffeescript
you made mistake:
have put test.coffee
file in folder /app/assets/javascripts/
- there s
@ end of javascripts. should work.
also should know compiled test.js
file not put in /public/javascript/
folder. instead play uses target
folder compiled code (*.class
files, compiled assets *.coffee
file, etc.). in particular case compiled javascript file put in target/web/public/main/javascripts/
play pick when serving file client. have through target
folder idea of how play organizes compiled resources. tip: in case doesn't work, doesn't compile etc. think should may got idea delete target
folder start "fresh". (or use sbt clean
or activator clean
).
Comments
Post a Comment