Skip to content

Instantly share code, notes, and snippets.

@jxnblk
Created May 9, 2016 21:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jxnblk/7f11eb4ac32c0b756ee67a45a1854ca6 to your computer and use it in GitHub Desktop.
Save jxnblk/7f11eb4ac32c0b756ee67a45a1854ca6 to your computer and use it in GitHub Desktop.
/*
* Node script to console log a data uri
* from geomicons-open paths.
* Useful for using the SVGs as background images in CSS.
*/
const Datauri = require('datauri')
const icons = require('geomicons-open')
const datauri = new Datauri()
const path = icons.paths.check
const color = '#fff'
const svg = `
<svg
xmlns='http://www.w3.org/2000/svg'
viewBox='0 0 32 32'
width='32' height='32'
fill='${color}'
>
<path d='${path}' />
</svg>
`.replace(/\n/g, '')
datauri.format('.svg', svg)
const uri = datauri.content
console.log(uri)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment