css - 如何注释掉 Asset Pipeline Manifest 中的资源

标签 css ruby-on-rails grails asset-pipeline

我需要评论 application.js Assets 管道 list 文件中包含的文件之一,向 list 添加或包含文件的方式是通过 list 文件中的评论。例如,require bootstrap 表示 bootstrap.css 或 bootstrap.js 文件分别包含在应用程序的 css 或 javascript 资源中。该文件的示例如下所示

/*
 * This is a manifest file that'll be compiled into application.css, which will include      all the files
 * listed below.
 *
 * Any CSS file within this directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the top of the
 * compiled file, but it's generally better to create a new file per style scope.
 *
 *= require main
 *= require mobile
 *= require_self
 */
  console.log("This javascript is also added");

我想注释掉 main.css,而不是删除它,在线搜索但没有找到任何有用的信息, Assets 管道刚刚引入 grails 2.4,采用了 ruby​​ on rails,我认为能够注释掉 Assets 管道 list 文件中的 css 或 javascript 资源。

最佳答案

此 CSS list 中的注释与典型的 CSS 注释没有区别。 ///* ... */。您在这里遇到的问题非常简单,您忽略了要注释掉的行上的等号。这个等号向解析器表明它应该对该行进行操作,删除等号会将特定行变成注释。

因此,注释掉 main:

/*
 * This is a manifest file that'll be compiled into application.css, which will include      all the files
 * listed below.
 *
 * Any CSS file within this directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the top of the
 * compiled file, but it's generally better to create a new file per style scope.
 *
 * NOTICE: the line below does NOT begin with an equals sign, and will be treated as a comment.
 * require main
 *= require mobile
 *= require_self
 */
  console.log("This javascript is also added");

关于css - 如何注释掉 Asset Pipeline Manifest 中的资源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26074767/

相关文章:

html - SVG 作为 div 背景

javascript - 修复一个看起来不稳定的倒数计时器

ruby-on-rails - 在 Ruby 中根据值从哈希集中选择一些哈希

html - 如何限制悬停一次不应用于所有链接?

CSS3 calc() 验证 : Value Error : width Parse Error

ruby-on-rails - 通过电子邮件访问 Paypal 账户

ios - 使用 Doorkeeper & Devise 连接到 Rails API 时无法注销 iOS Swift 应用程序

groovy - 在 Grails 中使用 Java 类

Grails[Groovy],如何获取一个类没有继承的所有方法的列表?

grails - 排除 Grails 构建范围依赖项