sprockets

https://github.com/rails/sprockets

Ruby

Rack-based asset packaging system

Sprockets::SourceMapUtils#format_source_map

Puglic: Transpose source maps into a standard format

NOTE: Does not support index maps

version => 3
file    => logical path
sources => relative from filename

  Unnecessary attributes are removed

Example

    map
    #=> {
    #  "version"        => 3,
    #  "file"           => "stdin",
    #  "sourceRoot"     => "",
    #  "sourceContents" => "blah blah blah",
    #  "sources"        => [/root/logical/path.js],
    #  "names"          => [..],
    #}
    format_source_map(map, input)
    #=> {
    #  "version"        => 3,
    #  "file"           => "logical/path.js",
    #  "sources"        => ["path.js"],
    #  "names"          => [..],
    #}

Source | Google | Stack overflow

Edit

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

cd sprockets

open lib/sprockets/source_map_utils.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Sprockets--SourceMapUtils-format_source_map-for-pr


# Commit to git

git add lib/sprockets/source_map_utils.rbgit commit -m "better docs for Sprockets::SourceMapUtils#format_source_map"


# 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--SourceMapUtils-format_source_map-for-pr

hub pull-request


# Celebrate!