-
-
Notifications
You must be signed in to change notification settings - Fork 204
Description
I'm submitting a feature request
This is puzzling me for a long time and I would like to start a discussion about this. What do we need to change so that the html-loader is able to include the width
and the height
of an image. For instance:
<img src="path/to/image.jpg">
should become
<img src="9df78hdfh8dfhjd.jpg" width="400" height="200">
The motivation behind this is that the browser can proceed with layout calculations without waiting for the image to download. This should yield faster initial paints, especially on high-latency networks.
From my current POV, this makes sense in every use-case I thought of, but it may break code if there are already contradicting width
and height
attributes (but: who does that?).
However, the problem is: The file- and the url-loader only return a string. We have no way to pass meta information about the image. In order to not break existing code, we could change the file- and the url-loader to return an object instead of a string, but with a toString()
method attached. This way, the object would be casted to a regular url in all situations where it is used as a string. But the html-loader would be able to use additional information about the referenced file.
This proposal could also allow other, new use-cases. What are your ideas?
@hemanth @d3viant0ne @sokra @TheLarkInn @bebraw