class Sprockets::Base

def find_all_linked_assets(*args)

def find_all_linked_assets(*args)
  return to_enum(__method__, *args) unless block_given?
  parent_asset = asset = find_asset(*args)
  return unless asset
  yield asset
  stack = asset.links.to_a
  linked_paths = {}
  while uri = stack.shift
    yield asset = load(uri)
    last_filename = linked_paths[asset.logical_path]
    if last_filename && last_filename != asset.filename
      raise DoubleLinkError.new(
        parent_filename: parent_asset.filename,
        last_filename:   last_filename,
        logical_path:    asset.logical_path,
        filename:        asset.filename
      )
    end
    linked_paths[asset.logical_path] = asset.filename
    stack = asset.links.to_a + stack
  end
  nil
end