I am currently not using a Mac for my work, but I came across retina.js while surfing the web. I would like to know if it is necessary to include this library into my web projects? If I don’t, would my projects look good on all Mac devices? I currently do not have any issues with work on other devices. I have not previewed it on any apple device yet, as it is still a work in progress.
Not even remotely required
It looks like it’s primary purpose is to automatically do the work of
srcset, an attribute that allows you to specify images for different screen profiles, such as the high-density of Apple’s “retina” screens.
srcset is trivial to use and doesn’t requirement much extra work on your part. In my opinion, everyone should learn how to use
srcset appropriately anyway.
In my opinion, there are several compelling reasons not to use this library.
- You can do what it does on your own
- It’s yet-another-script to fire on your page, which slows your page
- It breaks the intended accessibility of
srcset(allowing the browser and user to determine how to use the information in srcset, rather than you selecting what to load)
It is also worth mentioning that several browsers allow you to assign pixel density and other responsive settings using dev tools. For example, Chrome has Device Mode. These are useful for seeing if features like
srcset (or retina.js, if you did chose to use that library) are actually working as expected. So you don’t need to hunt down or a fancy-pants Mac for testing purposes.