img-to-svg-replace

0.0.1 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i img-to-svg-replace

Weekly Downloads

2

Version

0.0.1

License

MIT

Last publish

Collaborators

  • miguelmota