responsive-image-utils
Version:
Utility functions to make it easier to work with auto generated responsive images for better performance optimised images.
46 lines (31 loc) • 2.22 kB
Markdown
# Responsive image utilities
Utility functions to make it easier to work with auto generated responsive images for better performance optimised images.
[](https://github.com/prettier/prettier)
[](https://greenkeeper.io/)
[](https://travis-ci.org/kbalagtey-tacit/responsive-image-utils)
[](https://coveralls.io/github/kbalagtey-tacit/responsive-image-utils)
[](https://david-dm.org/kbalagtey-tacit/responsive-image-utils?type=dev)
### Overview
Use this utility lib to generate image srcsets and sizes used for responsive web design using a mobile-first approach.
This project is a lightweight utils version of **[Responsive Image Breakpoints Generator](https://www.responsivebreakpoints.com/)**.
### How it works?
Please spend some time to read the following links which I think explains the concept of responsive images pretty well.
* https://ericportis.com/posts/2014/srcset-sizes/#part-2
* https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Responsive_images
### ES6 Usage
```js
npm install -D responsive-image-utils
```
ES6 Demo - https://codesandbox.io/s/1z15pnyk5j
### ES5 Usage
Add the following script tag to your project
```js
<script src="https://unpkg.com/responsive-image-utils/dist/responsive-image-utils.umd.js"></script>
```
ES5 Demo - https://jsfiddle.net/ikanedo/8h7nz15g/
### More information
[Want more information? Read the usage and step by step guide.](https://github.com/kbalagtey-tacit/responsive-image-utils/blob/master/USAGE.md)
### TSDocs
[Please visit the gh_pages for TSDocs.](https://kbalagtey-tacit.github.io/responsive-image-utils/)
### Contributions
[Start contributing](https://github.com/kbalagtey-tacit/responsive-image-utils/blob/master/CONTRIBUTING.md). Contributions are open to all.