Skip to content

Instantly share code, notes, and snippets.

@LedzZm
Last active June 30, 2023 13:24
Show Gist options
  • Select an option

  • Save LedzZm/db3f9f7514d9a9840f670ee77ed987ac to your computer and use it in GitHub Desktop.

Select an option

Save LedzZm/db3f9f7514d9a9840f670ee77ed987ac to your computer and use it in GitHub Desktop.
webpack (laravel) mix svg sprite
const mix = require('laravel-mix');
const SpriteLoaderPlugin = require('svg-sprite-loader/plugin');
mix.js('resources/js/app.js', 'public/js')
.sass('resources/sass/app.scss', 'public/css')
.webpackConfig({
module: {
rules: [
{
test: /resources\/images\/.*\.svg$/,
loader: 'svg-sprite-loader',
exclude: /node_modules/,
options: {
extract: true,
spriteFilename: 'icons-sprite.svg',
publicPath: 'images/sprites/',
runtimeCompat: true
}
}
]
},
plugins: [
new SpriteLoaderPlugin({ plainSprite: true}) // Sprites Plugin.
],
})
.version()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment