【发布时间】:2010-12-21 22:34:38
【问题描述】:
如果我使用 SASS,如何在 CSS 输出中启用行号?我找到了一篇文章,但我不太明白在哪里进行修改
http://pivotallabs.com/users/damon/blog/articles/765-standup-04-07-2009-we-have-questions#comments
你能帮帮我吗?
【问题讨论】:
标签: css ruby sass compass-sass
如果我使用 SASS,如何在 CSS 输出中启用行号?我找到了一篇文章,但我不太明白在哪里进行修改
http://pivotallabs.com/users/damon/blog/articles/765-standup-04-07-2009-we-have-questions#comments
你能帮帮我吗?
【问题讨论】:
标签: css ruby sass compass-sass
有人推荐了这个猴子补丁:
# 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
现在,您必须从 master 分支中拉入 rails-sass。
group :development, :test do
gem 'sass-rails', '~> 4.0.0', git: 'https://github.com/rails/sass-rails.git', branch: 'master'
end
【讨论】:
如果您碰巧使用 Sprockets 和 sprockets-sass gem,您可能需要这样做:
Sprockets::Sass.options[:line_comments] = true
【讨论】:
有一个名为 :line_comments 的选项,如果您将其设置为 true,Sass 将在您的编译输出中放置行号。
如何设置此选项取决于您使用 Sass 的方式。如果它在 Rails、Merb 或 Rack 应用程序中,您可以设置 Sass::Plugin.options[:line_comments] = true。
如果您使用的是指南针,请在配置文件中设置line_comments = false。
【讨论】: