如果我使用SASS,如何在CSS輸出中啓用行號?我發現了一篇文章,但我不太明白的地方進行修改如何在CSS輸出中啓用SASS行號?
http://pivotallabs.com/users/damon/blog/articles/765-standup-04-07-2009-we-have-questions#comments
你能幫助我嗎?
如果我使用SASS,如何在CSS輸出中啓用行號?我發現了一篇文章,但我不太明白的地方進行修改如何在CSS輸出中啓用SASS行號?
http://pivotallabs.com/users/damon/blog/articles/765-standup-04-07-2009-we-have-questions#comments
你能幫助我嗎?
如果將此設置爲true,則有一個選項:line_comments
,Sass會將行號放入編譯後的輸出中。
如何設置此選項取決於您如何使用Sass。如果它在Rails,Merb或Rack應用程序中,則可以設置Sass::Plugin.options[:line_comments] = true
。
如果您使用指南針,請在您的配置文件中設置line_comments = false
。
如果你碰巧使用鏈輪和寶石是,你可能需要做的是這樣的:
Sprockets::Sass.options[:line_comments] = true
有人建議這個猴子補丁:
# Had to use this instead as per comment by @glebtv https://github.com/rails/sass-rails/issues/157
module Sass
class Engine
def initialize(template, options={})
@options = self.class.normalize_options(options)
@options[:debug_info] = true
@template = template
end
end
end
猴子補丁但我認爲這樣做效果更好:https://github.com/rails/sass-rails/pull/181
現在,您必須從主分支中提取rails-sass。
group :development, :test do
gem 'sass-rails', '~> 4.0.0', git: 'https://github.com/rails/sass-rails.git', branch: 'master'
end
好的,我在config.rb文件中添加了'line_comments = false',但仍然沒有改變...我使用指南針,我做錯了什麼? – hex 2009-12-01 14:00:31
在compass.config中,sass_options = {:line_comments => true} – Kyle 2009-12-01 17:45:55
最近修復了羅盤中的錯誤。如果你可以升級到0.10.0.pre2或更高,它將工作。或者你可以做到凱爾的方式。 – chriseppstein 2009-12-01 19:25:11