如何在CSS输出中启用SASS行号?

如果我使用SASS,如何在CSS输出中启用行号? 我发现了一篇文章,但我不太明白在哪里进行修改

http://pivotallabs.com/users/damon/blog/articles/765-standup-04-07-2009-we-have-questions#comments

你可以帮帮我吗?

有一个名为:line_comments的选项,如果将其设置为true,Sass将在您的编译输出中放置行号。

如何设置此选项取决于您使用Sass的方式。 如果它在Rails,Merb或Rack应用程序中,您可以设置Sass::Plugin.options[:line_comments] = true

如果您使用指南针,请在配置文件中设置line_comments = false

如果您碰巧使用Sprockets和sprockets-sass gem,您可能需要这样做:

 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

现在,你必须从master分支中获取rails-sass。

 group :development, :test do gem 'sass-rails', '~> 4.0.0', git: 'https://github.com/rails/sass-rails.git', branch: 'master' end