optimus-css

0.1.2 • Public • Published

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.

Package Sidebar

Install

npm i optimus-css

Weekly Downloads

3

Version

0.1.2

License

MIT

Last publish

Collaborators

  • steve_fanduel
  • jimcrofty
  • krisyoung
  • bd
  • maxmanders
  • roryf
  • fdowner