imagepack
Pack multiple images into one binary file to minimise http requests. Supports modern browsers (IE 10+). Inspired by Magipack.
http://ianmcgregor.github.io/imagepack/example/
Installation
- npm:
npm install imagepack --save-dev
- bower:
bower install imagepack --save-dev
Usage
Packing images
var gulp = ;var imagepack = ; gulp; // you can also unpack the imagepack files to a directory:gulp;
Unpacking images in the browser
var Imagepack = ; var imagepack = verbose: true ; // call getImage to get an HTMLImageElement from the pack { // add all the images to the page: names;} // call getURI to get a Blob URI from the pack { // display the images in an animationFrame loop: var img = ; documentbody; var i = 0; var last = 0; { window; var now = Date; if now - last < 40 return; last = now; if i === sequencelength i = 0; imgsrc = imagepack; i++; } ;}
Dev setup
To install dependencies:
$ npm install
To run tests:
$ npm install -g karma-cli
$ karma start