我需要评论 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/