module Sprockets::ManifestUtils

def find_directory_manifest(dirname)

Returns String filename.

# => "/app/public/assets/.sprockets-manifest-abc123.json"
find_directory_manifest("/app/public/assets")

Examples

dirname - String dirname

Public: Find or pick a new manifest filename for target build directory.
def find_directory_manifest(dirname)
  entries = File.directory?(dirname) ? Dir.entries(dirname) : []
  entry = entries.find { |e| e =~ MANIFEST_RE } ||
    # Deprecated: Will be removed in 4.x
    entries.find { |e| e =~ LEGACY_MANIFEST_RE } ||
    generate_manifest_path
  File.join(dirname, entry)
end