Ember addon to combine SVG files into one JS file and inject it through dedicated component into application. It makes maintenance of SVGs easy and deliver the best possible interaction with SVGs.
ember install ember-cli-misvg
Define where your SVG icons are in public directory (sourceDirs param) and where the output
should be placed (outputFile param). Like this:
// ember-cli-build.js
let app = new EmberApp(defaults, {
misvg: {
files: {
sourceDirs: 'public/img/svg-icon',
outputFile: '/assets/svg-sprites.js'
},
misvgOptions: {
indent: 2
}
}
});Optionally you can also pass misvg configuration options via misvgOptions property.
Add generated script file that contains sprites to your project:
// index.html
<script src="{{rootURL}}assets/svg-sprites.js"></script>Use misvg-icon component with the name of SVG icon (in align with the filename). You can also scale it via width
and height params.
git clone https://github.com/vastec/misvg.gitcd ember-cli-misvgnpm install
npm run lint:jsnpm run lint:js -- --fix
ember test– Runs the test suite on the current Ember versionember test --server– Runs the test suite in "watch mode"ember try:each– Runs the test suite against multiple Ember versions
ember serve- Visit the dummy application at http://localhost:4200.
For more information on using ember-cli, visit https://ember-cli.com/.
This project is licensed under the MIT License.