CoffeeScript调用服务器端信息
我正在尝试将现有的 java 脚本文件转换为咖啡脚本。令我头疼的一行是
var imageSiteUp = '@Url.Content("~/Content/SiteUp.png")';
简单地将一个放入
imageSiteUp = '@Url.Content("~/Content/SiteUp.png")'
咖啡脚本中并不能解决问题。我想知道如何实现这一点。
I am trying to convert my existing java script file into coffee script. One line that gives my headache is
var imageSiteUp = '@Url.Content("~/Content/SiteUp.png")';
simply putting a
imageSiteUp = '@Url.Content("~/Content/SiteUp.png")'
into coffee script doesn't do the trick. I am wondering how this can be achieved.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您遇到此类问题时,最好查看生成的 javascript(在浏览器中使用开发工具)。这将显示您的浏览器正在运行的实际逻辑。这将捕获许多您可能不了解 CoffeeScript 在幕后所做的事情的问题 - 包括空格错误。
希望本机咖啡脚本调试正在进行中:
http:// www.infoq.com/news/2011/08/debug-languages-on-javascript-vm
When you have problems like this, it's always a good idea to go into your generated javascript (in the browser using development tools). That will show the actual logic your browser is running. This will catch many issues where you may not understand what coffeescript is doing under the hood - including whitespace errors.
Hopefully native coffeescript debugging is on the way:
http://www.infoq.com/news/2011/08/debug-languages-on-javascript-vm