JSPM

@ayctor/laravel-mix-svg-sprite

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2331
  • Score
    100M100P100Q140293F
  • License MIT

A quick Laravel Mix extension for svg sprite support.

Package Exports

  • @ayctor/laravel-mix-svg-sprite

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@ayctor/laravel-mix-svg-sprite) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Laravel mix svg sprite

This extension provides instant svg sprite support to your Mix (v4 and up) builds.

Usage

First, install the extension.

npm install @ayctor/laravel-mix-svg-sprite --save-dev

Then, require it within your webpack.mix.js file, like so:

let mix = require('laravel-mix');

require('@ayctor/laravel-mix-svg-sprite');

// customizable config
mix.svgSprite('resources/svg/*.svg', {
    output:  {
        filename: 'svg/sprite.svg',
        chunk: {
            name: '/svg/sprite',
            keep: true
        },
        svgo: {
            plugins: [{
                removeEmptyAttrs: true,
                convertStyleToAttrs: true,
            }],
        }
    },
    sprite: {
        prefix: false,
    }
});

And you're done! Compile everything down with npm run dev.

For full documentation on the configuration check out svg-spritemap-webpack-plugin