Changed the output of the method createFileObject() from a single File to File[].
This is because a single html element can output multiple files:
For example, a single <img> element can require multiple files to be bundled if the srcset attribute is used.
If we want to support file imports or CSS modules in JavaScript, a single <script> element will need to be able to add many different files to the bundle.
Bikeshedding:
Because the <source> element can be used for both images and videos, maybe we should rename ImageAsset to something more generic like FileAsset? Or would that be too generic?
Changes:
<img>
elementsrcset
attribute.<source>
element.srcset
attribute into account.Example:
Implementation notes:
createFileObject()
from a singleFile
toFile[]
. This is because a single html element can output multiple files:<img>
element can require multiple files to be bundled if thesrcset
attribute is used.<script>
element will need to be able to add many different files to the bundle.Bikeshedding:
<source>
element can be used for both images and videos, maybe we should renameImageAsset
to something more generic likeFileAsset
? Or would that be too generic?