Skip to content

Instantly share code, notes, and snippets.

@yspreen
Created April 11, 2022 05:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yspreen/5fd578f7fbbf7b3f2ce90f78eefe23aa to your computer and use it in GitHub Desktop.
Save yspreen/5fd578f7fbbf7b3f2ce90f78eefe23aa to your computer and use it in GitHub Desktop.
extract-js-map.sh
#!/bin/sh
mapfile="$1"
seq 0 $((`jq -r '.sources | length' "$mapfile"`-1)) | while read n
do
file="$(jq -r ".sources[$n]" "$mapfile")"
dir="$(dirname "$file")"
mkdir -p "$dir"
jq -r ".sourcesContent[$n]" "$mapfile" > "$file"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment