Sha256: 23fbcbc6f8757652f357a2a16119e33af28087b3122122ec9247fb5acc41c9e3

Contents?: true

Size: 610 Bytes

Versions: 1

Compression:

Stored size: 610 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/sass_reader')

module SassSort
  include SassReader


  def self.import_order
    unsorted = SassReader.list_partials
    unsorted.inject([]) do |ordered, file|
      ordered = ordered | depth_first(file, ordered)
    end
  end

  private
  def self.depth_first file, sorted
    local_hash = SassReader.dependencies file
    local_depends = local_hash.values
    local_depends.each do |partial|
      unless partial.empty? or sorted.include?(partial[0])
        sorted = sorted | depth_first(partial[0], sorted)
      end
    end
    sorted << file
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bundler-sass-0.1.2 lib/sass_sort.rb