问题描述
我有一个Scalatra应用程序,用于编译CoffeeScript,使用到默认位置 target / scala-2.9.1 / resource_managed / main / js
。我想把生成的javascript公开地在一个名为 src / main / webapp / coffee
的文件夹中,但是给出的示例默认为`/ target / .. 。
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")
我的build.sbt:
My build.sbt:
seq(coffeeSettings: _*)
// doesn't work
//(resourceManaged in (Compile, CoffeeKeys.coffee)) <<= ("src" / "main" / "webapp" / "coffee")
$ b b
如果它 src / main / webapp,我将如何引用我想要编译的资产进入
? build.sbt
/ coffeee
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
?
推荐答案
添加到您的build.sbt:
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将出现在 http:// localhost:8080 / js / example.js
src/main/coffee/example.coffee will be available at http://localhost:8080/js/example.js
这篇关于为CoffeeScript声明不同的编译路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!