0.1.2 • Published 9 years ago

optimus-css v0.1.2

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

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 CSS url() declaration.