【发布时间】:2015-10-14 00:26:19
【问题描述】:
我开始在我的 Meteor 应用程序上使用 Coffeescript,虽然在包中一切正常,但在将我的 js 文件模板函数转换为 .coffee 时遇到了一些问题。
即使在我编译咖啡脚本时它似乎是正确的,但在我呈现网页时似乎并没有触发我的助手和事件。我什至在 Web 控制台上都没有收到错误消息。
我搜索了,但除了this thread,什么都找不到。
我使用 Jade、Coffeescript,我的 .coffee 和 .jade 文件位于同一个文件夹中,如下所示:
client/templates/myTemplate/myTemplate.jade
client/templates/myTemplate/myTemplate.coffee
我尝试了 _ 方法,将我的文件重命名为 .html.jade 和 js.coffee,但到目前为止没有任何效果。如果我将计算的 javascript 放在 myTemplate.js 文件中,一切正常。
有什么想法吗?
以下是代码示例:
Template.loginButton.helpers
statusText: () ->
console.log 'anybody there?'
if Meteor.user() then "Déconnexion" else "Connexion"
【问题讨论】:
标签: javascript meteor coffeescript pug template-engine