Function svgUrl

  • 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\...`})`

    Parameters

    • strings: any

      template strings

    • Rest ...rest: any[]

      template values

    Returns string

    Example

    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,...