Joh*_*ved 5 css grails ruby-on-rails asset-pipeline
我需要评论application.js资产pipeleine清单文件中包含的其中一个文件,向清单添加或包含文件的方式是通过清单文件中的注释.例如,需要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");
Run Code Online (Sandbox Code Playgroud)
我想要注释掉main.css,而不是删除它,在线搜索但没有找到任何有用的信息,资产管道刚刚引入到ruby on rails中的grails 2.4中,我认为能够注释掉它会很有用资产管道清单文件中的css或javascript资源.
这个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");
Run Code Online (Sandbox Code Playgroud)