2

我有一个使用https://github.com/softprops/coffeescripted-sbt将 CoffeeScript 编译到默认位置的 Scalatra 应用程序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

4

1 回答 1

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

于 2012-11-28T07:26:51.530 回答