Declaring a different compile path for CoffeeScript

假装没事ソ 提交于 2019-12-22 18:45:37

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/13595453/declaring-a-different-compile-path-for-coffeescript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!