I have an angular2 project which was created via angular-cli. In webpack there is a loader to load the svg sprite and also to generate that sprite from list of svgs. But how do I can use this functionality in my current project when angular-cli doesn't allow me to change webpack.config?
Thanks.
npm install --save-dev svg-sprite
src/svgs
sprite-config.json to your project root{
    "dest": "src/",
    "mode": {
        "css": {
            "dest": "sprites",
            "render": {
                "scss": {
                    "dest": "_sprite.scss"
                }
            }
        }
    }
}
package.json
"sprites": "svg-sprite --config sprite-config.json src/svgs/*.svg"
@import to your main styles.scss
@import './sprites/sprite';
npm run sprites
Add this to your scripts to build in one step
"start": "npm run sprites && ng serve",
"build": "npm run sprites && ng build --prod"
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With