0

I have the following svg-string:

const svgString = `<svg height="210" width="400"><path d="M150 0 L75 200 L225 200 Z"/></svg>`

I would like to convert this string

const convertedSvgString = convertSvgString(svgString)

so i can use it with css mask-image

mask-image: url(`data:image/svg+xml;base64,${convertedSvgString}`)

How do i define convertSvgString so it will work in a Node environment as well as any modern browser?

johann1301s
  • 225
  • 3
  • 10

0 Answers0