vshepel / vite-svg-sprite-wrapper

Creating one sprite file on the fly
27 stars 6 forks source link

Sprite SVG option: "mode.symbol.sprite" causes infinite loop during vite build watch #3

Closed dlerm closed 11 months ago

dlerm commented 1 year ago

Thanks for creating this plugin, it is really helpful to setup an svg sprite setup for my Shopify theme repo.

In configuring the plugin, I attempted to rename the outputed file to svg-sprites.liquid as that is the extension I need it in.

To do so, I set up the plugin like this:

ViteSvgSpriteWrapper({
  icons: 'src/icons/*.svg',
  outputDir: 'shopify/snippets',
  sprite: {
    mode: {
      symbol: {
        sprite: '../svg-sprites.liquid', // rename
      },
    },
    shape: { ... },
  },
});

After making this update, when I run vite build --watch from the command line, the project builds over and over in an infinite loop even though I'm not changing any of the watched files.

Do you happen to know why this might be happening? Any help is appreciated.

vshepel commented 1 year ago

@dlerm Hello, can't reproduce this, it works for me, check it out:

ViteSvgSpriteWrapper({
  icons: 'svg/*.svg',
  outputDir: '',
  sprite: {
    mode: {
      symbol: {
        sprite: '../sprite.liquid',
      },
    },
  },
}),

image

vshepel commented 11 months ago

Can't reproduce