2014-09-27 73 views
4

我需要评论application.js资产管道清单文件中包含的文件之一。向清单添加或包含文件的方式是通过评论清单文件。例如需要引导意味着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,不删除它,在网上搜索,但没有发现任何有用的信息,只需引入Grails的2.4资产管道从红宝石通过了rails,我认为能够在资产管道清单文件中注释掉css或javascript资源会很有用。

+0

你想注释掉需要主? – 2014-09-27 13:09:12

+0

是请或其他任何文件 – JohnTheBeloved 2014-09-27 13:48:16

+0

在您的示例中,只需从想要发表评论的行中删除等号。例如'* = require main'变成'* require main' – 2014-09-27 13:58:18

回答

7

此CSS清单中的注释与典型的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");