如何注释掉rails 3.1 asset require语句
是否可以在新的 app/assets/application.js 文件中注释掉这一行?如果是这样,怎么办?
//=require jquery_ujs
我的意思是,它已经被注释掉了,以避免被误解为 CoffeeScript 或 JavaScript,但它显然仍然有其用途。
Is it possible to comment out this line in the new app/assets/application.js file? If so, how?
//=require jquery_ujs
I mean, it's already commented out to avoid being misconstrued as CoffeeScript or JavaScript, but it's obviously serving a purpose still.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
取自 Sprockets 1.02 github(Sprockets 2 是 Rails 3.1 用于完成资产的内容)加载中):
这意味着
//= jquery_ujs
是一个指令。它指示 Sprockets 在编译所有 jquery 文件时包含 jquery_uls 文件。如果您不希望包含该文件,只需删除等号,该指令就会成为注释。
Taken from the Sprockets 1.02 github (Sprockets 2 is what rails 3.1 uses to accomplish asset loading):
What this means is that
//= jquery_ujs
is a directive. It instructs Sprockets to include the jquery_uls file when it compiles all the jquery files.If you don't want that file included, just remove the equals sign and the directive becomes a comment.
又短又快……
只需去掉=号即可。
Short and fast ...
... just remove the = sign.
我讨厌的是,它实际上是在单行注释中寻找
=
而不是//=
的组合。要禁用,请将
//
放在//=
之后:或取消等号
=
之前的任何内容都将不起作用:What I hate about this, is that it is really looking for a
=
inside a single line comment instead of the combination of//=
.To disable, put the
//
after the//=
:or kill the equal sign
Anything before the
=
will not work:你可以这样做:
带有 ('') 的 require 行将不会被加载。
You can do something like this:
require lines with ('') will not be loaded.