Tokamak
Tokamak copied to clipboard
Support `srcset` attribute in the HTML renderer for `Image`
This one's somewhat hard (I don't have a clear vision for it yet) and most probably needs some kind of integration with carton. There's also still the problem of detecting image extensions, as in general the name parameter of Image does not expect to contain an image file extension, especially if we're looking for as complete compatibility with SwiftUI as possible. Maybe we should provide a tighter integration with .xcassets catalogues via carton and infer the extension and different 2x and 3x slices from it? Also interesting to know how is srcset supported in other asset bundlers?
I like the idea of using xcassets. Although I’ve never used them outside Xcode, and wonder if that would be a subpar experience for people developing on non-Apple platforms? Probably beneficial to include anyways, though.
How do React and Vue people handle srcset and do they have any asset pipelines that handle it automatically? If they don't do any special handling by default right now, supporting .xcasset would be beneficial anyway at least for those who come from the SwiftUI world. We can evolve the approach and build something smarter based on what we learn after that.
gatsby-image uses a build step to automatically resize a single image. I don’t think there’s really a container format for multiple image sizes, so sticking with xcassets (and maybe providing a CLI tool to convert a single image to xcasset format) would probably be the best approach.