This package has been deprecated. Use svg-to-inline instead, see github.com/tiagoporto/svg-to-inline.
A jQuery plugin to replace <image> and <object> embed SVG inline.
<object type="image/svg+xml" data="htts://somesvg.svg" class="svg"></object>
<img src="https://somesvg.svg" class="svg">
Will be replaced by the linked SVG
<!-- Replaces <object> -->
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
<circle cx="50" cy="50" r="50"/>
</svg>
<!-- Replaces <img> -->
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
<rect x="50" y="20" width="150" height="150" />
</svg>
npm install jquery-svg-to-inline
$('.svg').svgToInline()
By default the trigger class isn't used on inline svg. If you want to use it, set it to true
.
$('.svg').svgToInline({useTriggerClass: true})
<img src="https://somesvg.svg" class="svg">
Will generate
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" class="svg">
<circle cx="50" cy="50" r="50"/>
</svg>
jQuery SVG to inline is released under the terms of the MIT license.