我正在 Play 2.1.0 中尝试使用 CoffeeScript 的第一步。我创建了一个新应用程序并将我的 CoffeeScript 文件 main.coffee 放在 app/assets/javascripts/中。
我希望在启动 Play 应用程序(在 Play 控制台中输入“运行”)时,我的 CoffeeScript 将被编译,并将生成的 main.js 放置在 public/javascripts 目录中。
但是没有在该目录中创建 main.js。我是否必须在其他地方添加一些配置?
最佳答案
如 CoffeeScript doc 中所述:
Note that managed resources are not copied directly into your application’s public folder, but maintained in a separate folder in target/scala-2.x.x/resources_managed.
您必须通过
Assets
访问它使用反向路由的 Controller :<script src="@routes.Assets.at("javascripts/main.js")">
关于CoffeeScript 未在 Play 2.1.0 中编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14820768/