0.0.1 • Published 8 years ago

img-to-svg-replace v0.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

img-to-svg-replace

Replace image tags containing SVG source urls with the SVG content.

Gets around the problem where links in SVGs don't work when used as image tag. This replaces the image tag with the SVG content. Came out of necessity when working with a platform that didn't allow direct SVG elements. Be aware it's still restricted to CORS.

Demo

https://lab.miguelmota.com/img-to-svg-replace

Usage

const imgToSvgReplace = require('img-to-svg-replace');

imgToSvgReplace(document.querySelectorAll('img'));

Turns

<img src="js.svg">

To

<svg>...</svg>

License

MIT