Last active
June 30, 2023 13:24
-
-
Save LedzZm/db3f9f7514d9a9840f670ee77ed987ac to your computer and use it in GitHub Desktop.
webpack (laravel) mix svg sprite
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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