Last active
February 14, 2017 01:20
-
-
Save avioli/f80cccd25f11921c65267c1b047a5a34 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
test -n "$2" && EXT=$2 || EXT=${1##*.} | |
INTEGRITY=$(curl -sL "$1" | openssl dgst -sha384 -binary | openssl enc -base64 -A) | |
if [ "$EXT" = "css" ]; then | |
echo '<link rel="stylesheet" href="'$1'" integrity="sha384-'$INTEGRITY'" crossorigin="anonymous">' | |
else | |
echo '<script src="'$1'" integrity="sha384-'$INTEGRITY'" crossorigin="anonymous"></script>' | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment