Question

I have a Scalatra app that compiles CoffeeScript, using https://github.com/softprops/coffeescripted-sbt, to a default location, target/scala-2.9.1/resource_managed/main/js. I want to put the generated javascripts somewhere available to me publicly, in a folder called src/main/webapp/coffee, but the example given defaults to `/target/...'

resourceManaged in (Compile, CoffeeKeys.coffee)) <<= (crossTarget in Compile)(_ / "your_preference" / "js")

My build.sbt:

seq(coffeeSettings: _*)

// doesn't work
//(resourceManaged in (Compile, CoffeeKeys.coffee)) <<= ("src" / "main" / "webapp" / "coffee")

How would I reference the path I want the compiled assets to go into inside build.sbt correctly, if it's src/main/webapp/coffeee?

Was it helpful?

Solution

add to your build.sbt:

//compiles your CoffeeScript files to resource_managed/main/webapp/js/
(resourceManaged in (Compile, CoffeeKeys.coffee)) <<= (resourceManaged in Compile)(_ / "webapp" / "js")

//makes ALL files in resource_managed/main/webapp as static file available
com.github.siasia.PluginKeys.webappResources in Compile <+= (resourceManaged in Compile)(_ / "webapp" )

src/main/coffee/example.coffee will be available at http://localhost:8080/js/example.js

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top