CoffeeScript调用服务器端信息

发布于 2024-12-19 18:11:36 字数 256 浏览 2 评论 0原文

我正在尝试将现有的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

煮茶煮酒煮时光 2024-12-26 18:11:36

当您遇到此类问题时,最好查看生成的 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文