2014-09-27 70 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");