load-svg-file
Load SVG files over XHR and embed the SVG content into the DOM. Compatible with every module type, environment, and variety (browser, Node.js, AMD, CommonJS, UMD, ES2015-2017) and uses Promises, where available.
Installation
# Using NPM npm install load-svg-file --save # Using Yarn yarn add load-svg-file # Using CDN - development https://cdn.jsdelivr.net/npm/load-svg-file/dist/load-svg-file.js # Using CDN - production (source map included besides the file) https://cdn.jsdelivr.net/npm/load-svg-file/dist/load-svg-file.min.js
To use CDN with SRI (Subresource Integrity), check out the jsdelivr page and get the hash there.
Usage
// Loading an SVG file. // Loading an SVG file with options. // Loading an SVG file with callback. // Loading an SVG file with options and callback.
// With RequireJS (AMD). // In Node.js (CommonJS) or with Browserify.const loadSvgFile = // In ES6 (e.g.: with Babel) // In ES2015 // In ES2017await
For more, check out the documentation, examples and the tests.
Contribution
Any contribution is appreciated. To get going, check out the contribution guidelines, then the development manual.
Thank you, have fun!