Created
April 20, 2019 15:04
-
-
Save msikma/67b5a48dd6a36e6a8c7e7a78e6fcf644 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
# Retrieves the mime type, e.g. 'image/png' | |
mime=$(file -bN --mime-type "$1") | |
# Converts the file itself to Base64 | |
content=$(base64 -b0 < "$1") | |
printf "url('data:%s;base64,%s')\n" $mime $content |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment