How to include SASS line numbers in CSS output?

How to include line numbers in CSS outputs if I use SASS? I found the article, but I did not quite understand where to make the changes.

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

could you help me?

+3
source share
3 answers

There is an option called :line_commentsif you set it to true, Sass will put line numbers in your compiled output.

How to set this parameter depends on how you use Sass. If in a Rails, Merb or Rack application you can install Sass::Plugin.options[:line_comments] = true.

, line_comments = false .

+10

Sprockets sprockets-sass, :

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

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

Monkey patch works, but I think it works even better: https://github.com/rails/sass-rails/pull/181

Now you need to pull the rails from the main branch.

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

Source: https://habr.com/ru/post/1724367/


All Articles