- Wendy optimizes your CSS by inlining images into a dataurl
- She also converts your px unit values into rem and provides a fallback
$ sudo npm install -g wendy
You can use wendy from the command line:
$ wendy your-file.css
Wendy has various options. Check them out with -h:
$ wendy -h
Usage: wendy [options] <file>
Options:
-h, --help output usage information
-V, --version output the version number
-p, --basePath [path] set the base path to inline images
-t, --mimeTypes [mimetypes] comma separated mimetypes, regexp allowed
-m, --maxDataUrlSize [size] maximum in bytes or 32kb, 2mb, 3gb
-b, --baseFontSize [font-size] set the base font size
-v, --verbose adds verbose output to error log
-o, --out [file] write the output to a file
Wendy is powered by Rework. Her Plugins can be used in Javascript.
var wendy = require('wendy'),
rework = require('rework'),
inlineOptions = {
basePath: 'css/',
mimeTypes: ['image/png', 'image/jpg', 'image/gif'],
maxSize: 1024 * 32,
},
remifyOptions = {
baseFontSize: 16
};
// all options except for basePath are optional
var css = rework(yourCss)
.use(wendy.inline(inlineOptions))
.use(wendy.remify(remifyOptions))
.toString()