This is a debugging session for problem: Compass/compass#989
Using this sample project: https://github.com/krisbulman/compass-image-url-example
####Summary of problem####
Since this commit in Sass, relative paths to files are not output on a second compile in all versions of compass (stable and dev), when path functions such as image-url()
and font-url()
are used within mixins.
####Debugging session using debugger####
1.defaults.rb - direct output of debugger session of default_images_path on first compile
$ compass clean
$ compass compile
step through debugger and print vars
2.defaults.rb - direct output of debugger session of default_images_path on second compile after non code change of _mixins.scss
$ compass compile
step through debugger and print vars
3.defaults.rb.diff - a diff of the two debugger sessions
####Points worth noting:####
- The final stylesheet recompiles when it shouldn't, a compile can be triggered just by modifying 1 space in _mixins.scss
- This function (line 224 of urls.rb) fails to return true because options[:css_filename] is nil in the second compile, so the relative path is not added to filenames.
def compute_relative_path(path)
if (target_css_file = options[:css_filename])
Pathname.new(path).relative_path_from(Pathname.new(File.dirname(target_css_file))).to_s
end
end