Skip to content

Instantly share code, notes, and snippets.

@alexey-detr
Created March 6, 2017 08:35
Show Gist options
  • Save alexey-detr/9006ed8a39721daef22467fb3e8fe26e to your computer and use it in GitHub Desktop.
Save alexey-detr/9006ed8a39721daef22467fb3e8fe26e to your computer and use it in GitHub Desktop.
Fish function to get CSS background-url compatible base64 encoded file data, where filename specified as argument
# You have to install mime package
# npm install -g mime
function base64urldata
set filename $argv[1]
echo "data:"(mime $filename)";base64,"(cat $filename | openssl enc -base64 | tr -d '\n')
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment