Permissions: -rwxr-xr-x
#!/bin/bashset -euo pipefailegrep -oh 'https://[^"]+\.js' "$@" | sort -u | while read url; do hash=`curl -fsS "$url" | openssl dgst -sha384 -binary | openssl base64 -A` sed -i "\|$url| c\\ <script src=\"$url\" integrity=\"sha384-$hash\" crossorigin=\"anonymous\"></script>" "$@"doneegrep -oh 'https://[^"]+\.css' "$@" | sort -u | while read url; do hash=`curl -fsS "$url" | openssl dgst -sha384 -binary | openssl base64 -A` sed -i "\|$url| c\\ <link rel=\"stylesheet\" href=\"$url\" integrity=\"sha384-$hash\" crossorigin=\"anonymous\">" "$@"done