From d0846d76c5c0f09d1cb1c37262ae6300a348448b Mon Sep 17 00:00:00 2001 From: Chris Eppstein Date: Thu, 28 Jan 2010 00:37:17 -0800 Subject: [PATCH] Handle relative imports --- doc-src/lib/stylesheets.rb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/doc-src/lib/stylesheets.rb b/doc-src/lib/stylesheets.rb index ff60f59c..5f7114de 100644 --- a/doc-src/lib/stylesheets.rb +++ b/doc-src/lib/stylesheets.rb @@ -44,15 +44,21 @@ def reference_path(options) end def import_paths - Compass::Frameworks::ALL.inject([]) {|m, f| m << f.stylesheets_directory} + paths = Compass::Frameworks::ALL.inject([]) {|m, f| m << f.stylesheets_directory} + paths.map!{|p|[p, '']} + if @item[:stylesheet] + paths << [File.join(Compass::Frameworks[@item[:framework]].stylesheets_directory, + File.dirname(@item[:stylesheet])), File.dirname(@item[:stylesheet])] + end + paths end def stylesheet_path(ss) possible_filenames_for_stylesheet(ss).each do |filename| import_paths.each do |import_path| - full_path = File.join(import_path, filename) + full_path = File.join(import_path.first, filename) if File.exist?(full_path) - return filename + return "#{import_path.last}#{"/" if import_path.last && import_path.last.length > 0}#{filename}" end end end