gulp-css-image-dimensions
css-image-dimensions plugin for gulp
This plugin is meant as a drop-in replacement for the image-width and image-height functions from Compass.
Usage
First, install gulp-css-image-dimensions
as a development dependency:
npm install --save-dev gulp-css-image-dimensions
Then, add it to your gulpfile.js
:
Note for usage in conjunction with CSS-Preprocessors If you are using this plugin in conjunction with a preprocessore like Sass, you should make sure to call this plugin after it.
var cssImageDimensions = ; gulp
In your CSS, you can now write the following:
assuming imagename.png is e.g. 25x30px, gulp-css-image-dimensions will turn this into
API
css-image-dimensions(imagesPath)
imagesPath [optional]
Type: String
Default: .
The path to your images directory. This can be either absolute, or relative to your css files.