为CoffeeScript声明一个不同的编译路径

时间:2012-11-28 00:01:18

标签: scala coffeescript sbt scalatra

我有一个Scalatra应用程序,使用https://github.com/softprops/coffeescripted-sbt将CoffeeScript编译到默认位置target/scala-2.9.1/resource_managed/main/js。我希望将生成的javascripts公开放在某个名为src/main/webapp/coffee的文件夹中,但是给出的示例默认为`/ target /...'

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

我的build.sbt:

seq(coffeeSettings: _*)

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

我如何正确地引用我希望已编译资产进入build.sbt内部的路径,如果它是src/main/webapp/coffeee

1 个答案:

答案 0 :(得分:1)

添加到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将在http://localhost:8080/js/example.js

提供