Converts an SVG string to data url. This is useful for creating images from SVGs, or using SVGs in CSS. To use put in template string: url(${svgUrl\...`})`

const url = svgUrl\`
<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> ... </svg>
\`
console.log(url) // data:image/svg+xml;charset=UTF-8,...
  • Parameters

    • strings: any

      template strings

    • ...rest: any[]

      template values

    Returns string