js-inliner

Inline <script> tags under the specified size

npm install js-inliner
2 downloads in the last week
4 downloads in the last month

JS Inliner

Inline tiny JS files into your markup without doing something gnarly.

Build Status NPM version Dependency Status

Usage

var inliner = require("js-inliner");

inliner(stream, { root : "/fooga/wooga", size : 1024 }, function(err, text) {
    if(err) {
        throw new Error(err);
    }

    console.log(text.toString());
});

API

inliner(stream, [options], cb)

  • stream {Stream} Readable stream to parse
  • options {Object}
  • cb {Function}
    • err {Error | null}
    • text {Buffer} Rewritten text

Options

  • root {String} location on disk to use as the root of URLs. Default is process.cwd().
  • size {Number} maximum size in bytes of files to inline. Default is 1024.

A Note on Versioning

This project's version number currently has a "0.x" prefix, indicating that it's a new project under heavy development. As long as the version number starts with "0.x", minor revisions may introduce breaking changes. You've been warned!

Once it reaches version 1.0.0, it will adhere strictly to SemVer 2.0.

npm loves you