optimus-css
v0.1.2
Published
Inline CSS image references as base64 data-URIs
Downloads
3
Readme
Optimus CSS
Node.js stream transform and CLI to inline CSS image references as Base64-encoded data-URIs.
Install
npm install optimus-css
Usage
In your terminal (or package.json
scripts, or Makefile
):
optimus app/css/app.css --cwd app --output build --verbose
optimus --help
for options usage, also accepts multiple file paths.
In your code
var optimus = require('optimus-css'),
path = require('path');
fs.createReadStream(__dirname + '/app/css/app.css')
.pipe(optimus({ path: path.dirname('/app/css/app.css'), cwd: 'app' }))
.pipe(fs.createWriteStream(__dirname + '/build/app.css'));
Also supports new Optimus(options)
syntax and will output events:
notfound
- when an image file path cannot be resolved, event data will be the path as found in the CSSurl()
declaration.