Skip to content

simme/rework-imagesize

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rework Imagesize

Uses the Imagesize module to read an image's size and put that size in your CSS!

Usage

var rework = require('rework');
var size   = require('rework-imagesize');

var css = rework(str)
  .use(size('path/to/images/folder'))
  .toString();

Using the above JavaScript. This:

h1 {
  background: url('myimage.png');
  imgsize: myimage.png;
  text-indent: 100%;
}

Would produce something like:

h1 {
  background: url('myimage.png');
  text-indent: 100%;
  height: 201px;
  width: 300px;
}

You can also use the "properties" imgsizew and imgsizeh to get only the width or height of the image, respectively.

License

MIT

About

Get image size and put that in your CSS.

Resources

Stars

Watchers

Forks

Packages

No packages published