Created
May 1, 2023 16:29
-
-
Save gingerbeardman/c19ac6d2b8565fea9e3e45909ddddc9b to your computer and use it in GitHub Desktop.
Convert a file to data-uri
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 | |
echo "url('data:$(file -bN --mime-type "$1");base64,$(base64 < "$1")')" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example usage:
./uri.sh image.png | pbcopy
Afterwards the
data:image
will be on the clipboard.