I am trying to use the srcset
and sizes
HTML attributes for responsive images to serve a certain image to a certain screen size for performance optimization and responsive design. But Vue-loader doesn't seem to support them, anyone had a similar issue? If not what could be a possible solution to best optimize the app's performance that is mostly impacted by HD images.
Below is an example of what i am trying to implement in a .vue template
<img srcset="../assets/img-1.jpg 300w, ../assets/img-1-large.jpg 100vw"
sizes="(max-width: 56.25em) 20vw, (max-width: 37.5em) 30vw, 300px"
alt="photo 1"
src="../assets/img-1-large.jpg">
thanks in advance.
src
attribute in all screen sizes. – Estelleestensrcset
attribute for files to load via the url-loader so you have to do it manually viarequire()
. Can you please add what you tried to your question – Dubonnetsrcset
attribute is working and rendering my photos, however, thesizes
which is needed to inform the browser which resolution to use according to a certain screen size attribute, still does NOT work, here is a codepen of my attempt. thanks – Estelleesten