lihaoyi / hands-on-scala-js

Better documentation for Scala.js
142 stars 52 forks source link

Integrating Cient-Server example doesn't work #26

Closed kaesler closed 9 years ago

kaesler commented 9 years ago

I am working through some examples in the book and found this. In the section "A Client-Server Setup" the build.sbt has some code which is intended to copy the output Javascript code from the ScalaJS compilation into the resources directory of the Spray sub-project.

What task/command is supposed to trigger that copy? It doesn't seem to work for me when I compile the JVM code.

lihaoyi commented 9 years ago

This line https://github.com/lihaoyi/hands-on-scala-js/blob/master/examples/crossBuilds/clientserver/build.sbt#L25 is meant to trigger the copy

Could you be bumping into this issue https://github.com/lihaoyi/hands-on-scala-js/pull/25?

kaesler commented 9 years ago

No I already corrected the file name....

...However, never mind. I just discovered the "copyResources" task. When I run that from the root project the js files are generated and then copied to the app/jvm/target/scala-2.11/classes/ directory,from whence the Spray app can find them. Might be a good idea to add a sentence explaining that step, or I can make a PR to that effect.

To make matters worse I am working in the Eclipse IDE which does not seem to have any way to trigger this "copyResources" task. Will work directly in SBT. I wonder if IntellIJ is better in this regard?

lihaoyi commented 9 years ago

I've always already worked directly in SBT. IntelliJ always gives me the wrong answer to many things so I don't trust it, and eclipse probably is similar. In theory the task should happen automatically when you;re working within SBT