Less buggy import resolver. Closes GH-139.
This commit is contained in:
parent
7d9ab20be0
commit
8dc719ac22
@ -1,5 +1,5 @@
|
||||
- render 'main' do
|
||||
%aside(role="sidebar")
|
||||
%nav#local-nav
|
||||
%ul=item_tree(reference_item(:stylesheet => "_blueprint.scss"), :depth => 2, :omit_self => false, :heading_level => 2)
|
||||
%ul=item_tree(reference_item(:stylesheet => "blueprint.scss"), :depth => 2, :omit_self => false, :heading_level => 2)
|
||||
%article= yield
|
@ -1,5 +1,5 @@
|
||||
- render 'main' do
|
||||
- content_for :module_nav do
|
||||
%ul= item_tree(reference_item(:stylesheet => "_compass.scss"), :depth => 1, :omit_self => true, :headings => false)
|
||||
%ul= item_tree(reference_item(:stylesheet => "compass.scss"), :depth => 1, :omit_self => true, :headings => false)
|
||||
%aside(role="sidebar")= render 'partials/sidebar', :default_stylesheet => "_compass.scss"
|
||||
%article= yield
|
@ -30,9 +30,9 @@ end
|
||||
|
||||
def reference_item(options)
|
||||
stylesheet = options[:stylesheet]
|
||||
@site.cached("reference/item/#{stylesheet}") do
|
||||
path = stylesheet_path(stylesheet)
|
||||
if path
|
||||
@site.cached("reference/item/#{path}") do
|
||||
@items.detect do |i|
|
||||
if i.identifier =~ /^\/reference/ && i[:stylesheet]
|
||||
i[:stylesheet] == path
|
||||
@ -54,17 +54,18 @@ def reference_path(options)
|
||||
end
|
||||
|
||||
def import_paths
|
||||
paths = Compass::Frameworks::ALL.inject([]) {|m, f| m << f.stylesheets_directory}
|
||||
paths.map!{|p|[p, '']}
|
||||
paths = []
|
||||
if @item[:stylesheet]
|
||||
paths << [File.join(Compass::Frameworks[@item[:framework]].stylesheets_directory,
|
||||
File.dirname(@item[:stylesheet])), File.dirname(@item[:stylesheet])]
|
||||
File.dirname(@item[:stylesheet])),
|
||||
@item[:stylesheet]["/"] ? File.dirname(@item[:stylesheet]) : ""]
|
||||
end
|
||||
|
||||
paths += Compass::Frameworks::ALL.inject([]) {|m, f| m << f.stylesheets_directory}.map!{|p|[p, '']}
|
||||
paths
|
||||
end
|
||||
|
||||
def stylesheet_path(ss)
|
||||
@site.cached("stylesheet/path/#{ss}") do
|
||||
possible_names = possible_filenames_for_stylesheet(ss)
|
||||
import_paths.each do |import_path|
|
||||
possible_names.each do |filename|
|
||||
@ -74,7 +75,7 @@ def stylesheet_path(ss)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
nil
|
||||
end
|
||||
|
||||
def possible_filenames_for_stylesheet(ss)
|
||||
@ -85,9 +86,9 @@ def possible_filenames_for_stylesheet(ss)
|
||||
extensions = if ext.size > 0
|
||||
[ext]
|
||||
else
|
||||
[".sass", ".scss"]
|
||||
[".scss", ".sass"]
|
||||
end
|
||||
basenames = [base, "_#{base}"]
|
||||
basenames = ["_#{base}", base]
|
||||
filenames = []
|
||||
basenames.each do |basename|
|
||||
extensions.each do |extension|
|
||||
|
Loading…
Reference in New Issue
Block a user