Last Updated: February 25, 2016
·
1.339K
· ndorfin

Compass mixin for data URIs

Not sure if you've heard of this before, but Compass comes with a function to convert an image asset into a base64 data URI, using #{inline_image()}
An example:

.layer.padded
   background: rgb(203,210,216) #{inline_image("pinstripes.png")}

See: https://github.com/chriseppstein/compass/commit/5a015b3824f280af56f1265bf8c3a7c64a252621

1 Response
Add your response

Thanks for this. I am familiar with doing this on the command line with openssl base64 and just thought "I wonder if compass...". :)

over 1 year ago ·