Skip to content

Add @sveltejs/enhanced-img #496

@benmccann

Description

@benmccann

I had been holding off because I thought one of the issues might necessitate changing the API, but it looks like that's not necessary and things should be pretty stable now.

There's a webp and png in the demo app:

import welcome from '$lib/images/svelte-welcome.webp';

We should just have the png and enhanced-img will generate the webp and avif automatically.

It would also be nice to add to the skeleton project as I think no one should be shipping unoptimized images. For the skeleton app, it potentially could be a question like:

What image optimization should be used?

  • build-time optimization with @sveltejs/enhanced-img
  • fetch from CDN with @unpic/svelte
  • none

Finally, I don't really like that images are currently stored in $lib/images. This seems like it will just become a huge unorganized catch-all. Images can live in the folder where they're used alongside the +page.svelte that includes them. This should help keep things a bit more organized. At least this was one of Rich's original arguments in favor of +page.svelte. But we don't really demonstrate that and guide users down that path today

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions