module Sprockets::Bower

def resolve_alternates(load_path, logical_path)

Returns candiate filenames.

logical_path - String path relative to base
load_path - String environment path

Internal: Override resolve_alternates to install bower.json behavior.
def resolve_alternates(load_path, logical_path)
  candidates, deps = super
  # bower.json can only be nested one level deep
  if !logical_path.index('/'.freeze)
    dirname = File.join(load_path, logical_path)
    if directory?(dirname)
      filenames = POSSIBLE_BOWER_JSONS.map { |basename| File.join(dirname, basename) }
      filename  = filenames.detect { |fn| self.file?(fn) }
      if filename
        deps << build_file_digest_uri(filename)
        read_bower_main(dirname, filename) do |path|
          if file?(path)
            candidates << path
          end
        end
      end
    end
  end
  return candidates, deps
end