开发者

How do I enable SASS line numbers in CSS output?

How can I enable line numbers in CSS output if I am using SASS? I found an article but I didn't quite understand where to make the modif开发者_JS百科ications

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

Could you help me?


There's an option called :line_comments if you set this to true, Sass will place line numbers in your compiled output.

How to set this option depends on how you're using Sass. If it's in a Rails, Merb, or Rack application you can set Sass::Plugin.options[:line_comments] = true.

If you're using compass, set line_comments = false in your configuration file.


If you happen to be using Sprockets and the sprockets-sass gem, you may need to do it like this:

Sprockets::Sass.options[:line_comments] = true


Someone suggested this monkey-patch:

# 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

The monkey-patch works, but I think this works even better: https://github.com/rails/sass-rails/pull/181

For now, you have to pull in rails-sass from the master branch.

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜