2

This is probably a very basic thing, but I just can't get it to work. To the spray-template project I have added the sbt-js plugin.

When I run the js command it finds and processes my js files in src/main/[resources]/web/js/ and places them in target/scala-2.11/resource_managed/[main]/resources/web/js/

(The [ ] marks directories that shows up as resource directories in intellij).

I try to serve up the js files something like this, but it only works for the unprocessed file:

trait JsContent extends HttpService {
  val jsRoute = path("js1") {
    getFromResource("web/js/test.js") // The unprocessed js file loads fine.
  } ~ path("js2") {
    getFromResource("resources/web/js/test.js") // How do I locate the generated file?
  }
}

The directory containing the processed files is listed when doing show resourceDirectories in sbt console, but they are not included in the jar produced when running package.

So how to point out to sbt that I want to use the managed js resources?

Knotgrund
  • 23
  • 4
  • You could try running `package` and then just look in the generated jar where the resources end up. – jrudolph Dec 02 '14 at 14:11
  • The generated files are not included in the resulting jar file, only the source ones. The documentation for sbt-js states that If you're using xsbt-web-plugin (which I'm not), you should add `(webappResources in Compile) <+= (resourceManaged in Compile)`, so I guess I'm looking for something similar. – Knotgrund Dec 02 '14 at 15:13

0 Answers0