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


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


    • strings: any

      template strings

    • Rest any[]

      template values

    Returns string

Generated using TypeDoc