postcss-image-set-generator

Demo
Example or/* Input */ /* Output */
About this plugin
This plugin add postcss function for image-set
.
This function checks if only one argument was passed to it, it automatically makes thumbnails of the images according to the sizes previously set.
You must specify only one picture of the largest size and specify for which pixelity pixel it is used
Install
Prerequisites
- Node v4+
- C++11 compatible compiler such as gcc 4.8+, clang 3.0+ or MSVC 2013+
node-gyp
and its dependencies (includes Python)
npm install postcss-image-set-generator --save-devyarn add postcss-image-set-generator --dev
Example
Demo how it work look on this repo demo-modern-images-usage-css
Usage
Gulp
In Gulp you can use [gulp-postcss] with postcss-image-set-generator
npm package.
gulp;
Postcss Api
const readFileSync writeFileSync = ;const resolve = ;const postcss = ;const generatoRrr = ; const options = from: to: ;const from to = options; ;
Options
scales
type : Array
, default: [1, 1.5, 2, 3]
List supported scale images
suffix
type : String
, default: @x
Miniature images naming <name><suffix><scale>.<ext>
Example: icon-star.webp
-> icon-star@x2.webp
resolutionType
type: String
, default: x
Available Values dpi || dppx || x