ElMassimo/vite-plugin-image-presets

[Feature Request] Default preset

whaaaley opened this issue · 1 comments

It would be nice if there were a way to specify a default preset so every import didn't need the query string.

Maybe something like this...

    imagePresets({
      'default': widthPreset({
        widths: [425, 1024, 1200],
        formats: {
          webp: { quality: 100 },
          png: { quality: 100 }
        }
      })
    }),

Or this...

    imagePresets({
      'foobar': widthPreset({
        default: true,
        widths: [425, 1024, 1200],
        formats: {
          webp: { quality: 100 },
          png: { quality: 100 }
        }
      })
    }),

Great plugin btw 👍 It's saved me a lot of time already.

Hi Dustin, thanks for the suggestion!

That would involve processing every image referenced in the project, so wouldn't recommend it for most projects, but in smaller sites it might be a nice one to have.

Ideally, we would detect if there's a default preset during init, and use that flag to avoid these checks instead checking by image extension.

PRs are welcome!