Run Compass with --sourcemap flag

compass-sass, css, sass

Solution

Source maps are included starting with Sass 3.3 or later, which is only compatible with Compass 1.0.

https://github.com/chriseppstein/compass/issues/1108

Adding the following to your config.rb will only add the sourcemap information directly to your compiled CSS:

sass_options = { :debug_info => true }

Output:

@media -sass-debug-info{filename{font-family:file\:\/\/\/home\/chris\/compass\/sass\/test\.scss}line{font-family:\0000314}}
.foo {
  color: red;
}

To get your sourcemap file(s), you need to add this option to your config.rb:

sourcemap = true

Console output:

$ compass watch
 modified config.rb
    clean css
   delete css/test.css
>>> Compass is watching for changes. Press Ctrl-C to Stop.
    write css/test.css
    write css/test.css.map

Problem

Does Compass support the --sourcemap option in Sass yet? I would like to run Sass through Compass. I have ``` sass_options = {:sourcemap => true} ``` in my config.rb, but when I run `compass watch` in my project folder no sourcemap files are generated. On the other hand, when I run ``` sass --compass --sourcemap --watch scss:css ``` The source file is generated, but the config.rb is ignored. (For anybody wondering what a sourcemap is, it's a file that allows Developer Tools inspector to point to the origin of a style in a Sass scss file when you inspect an element.)

Original source