为CoffeeScript声明不同的编译路径 [英] Declaring a different compile path for CoffeeScript

查看:122
本文介绍了为CoffeeScript声明不同的编译路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Scalatra应用程序,用于编译CoffeeScript,使用 https://github.com/softprops/coffeescripted- sbt 到默认位置 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声明不同的编译路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆