Compass: how to remove comments containing path to a package scss from generated css file?

十年热恋 提交于 2019-12-24 19:28:11

问题


We use compass in our project. It generates some css files, which look like this on my colleague's machine:

/* line 22, ../../../../.rvm/gems/ruby-1.9.3-p125/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
html {
  line-height: 1; }

/* line 24, ../../../../.rvm/gems/ruby-1.9.3-p125/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
ol, ul {
  list-style: none; }

/* line 10, ../sass/partials/dependencies/font-awesome/_larger.scss */
.fa-2x {
  font-size: 2em; }

But sometimes I have to update CSS by myself. I edit the corresponding sass file and run compass compile. It regenerates CSS successfully, but half of comments are changed:

/* line 22, C:/Soft/Ruby193/lib/ruby/gems/1.9.1/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
html {
  line-height: 1; }

/* line 24, C:/Soft/Ruby193/lib/ruby/gems/1.9.1/gems/compass-0.12.2/frameworks/compass/stylesheets/compass/reset/_utilities.scss */
ol, ul {
  list-style: none; }

/* line 10, ../sass/partials/dependencies/font-awesome/_larger.scss */
.fa-2x {
  font-size: 2em; }

Here's the problem: we store this CSS in a VCS, as not everyone in our team has Ruby and Compass installed. And each commit modifying one line in SASS expands to a thousand-line commit which changes comments (because we have compass installed in different directories).

Is there any way to prevent compass from adding comments about frameworks? I want to keep comments about SCSS coming from the project, but I want to get rid of comments that come from frameworks lying in a machine-specific place.


回答1:


This can be changed in config.rb

line_comments = false



回答2:


I added

line_comments = false

to my config/compass.rb to remove all of the line comments from the compiled stylesheets.



来源:https://stackoverflow.com/questions/20161219/compass-how-to-remove-comments-containing-path-to-a-package-scss-from-generated

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!