SVGs

Sprites

This should be done by default in v0.2.18. Otherwise follow the instructions below.

SVG sprites need a few things to be working.

  1. You will need the webpack-svgstore-plugin npm package if it's not already installed.
  2. You will need resources/assets/js/svg.js if you don't already have it. php artisan vendor:publish should give it to you if you don't.
  3. You will need the following in your webpack.mix.js:

    plugins: [
        new webpack.NormalModuleReplacementPlugin(/^\.\/package$/, function (result) {
        if (/cheerio/.test(result.context)) {
            result.request = "./package.json"
        }
        }),
    ]
    
    // ...
    
    .js('resources/assets/js/svg.js', 'public/js/svg.js')
    .version([
        'public/svg/sprite.svg'
    ])