sprockets

https://github.com/rails/sprockets

Ruby

Rack-based asset packaging system

Sprockets::Resolve#resolve_relative_path

Internal: Finds a relative file in a set of given paths

paths   - Array of Strings.
path    - String. A relative filename with or without extension
          e.g. "./jquery" or "../foo.js"
dirname - String. Base path where we start looking for the given file.
accept  - String. A Quality value incoded set of
          mime types that we are looking for. Can be nil.
          e.g. "application/javascript" or "text/css, */*"

Returns Array. Filename, type, path_pipeline, deps, index_alias

Source | Google | Stack overflow

Edit

git clone [email protected]:rails/sprockets.git

cd sprockets

open lib/sprockets/resolve.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Sprockets--Resolve-resolve_relative_path-for-pr


# Commit to git

git add lib/sprockets/resolve.rbgit commit -m "better docs for Sprockets::Resolve#resolve_relative_path"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-Sprockets--Resolve-resolve_relative_path-for-pr

hub pull-request


# Celebrate!