Simple stream interface for closure compiler, with full pipe support.

#closure-compiler-stream Streaming interface for closure compiler.

##Installation Add to your devDependencies:

  "dependencies": {...},
  "devDependencies": {
    "closure-compiler-stream": "~0.1.15"

or install directly:

npm install --save-dev closure-compiler-stream

then import in your build script:

var closure = require('closure-compiler-stream');

##Usage As a simple streaming compiler:

var closure = require('closure-compiler-stream'),
  fs = require('fs');
// As an intermediary step in a flow 
// As the terminus in a flow 
    js_output_file: 'path/to/minified.js'

With streaming build tools like gulp:

var gulp = require('gulp'),
  closure = require('closure-compiler-stream'),
  sourcemaps = require('gulp-sourcemaps');
// Basic compile 
gulp.task('closure', function () {
  return gulp.src('path/to/js/*.js')
// With sourcemaps 
gulp.task('closure:sourcemap', function () {
  return gulp.src('path/to/js/*.js')


var writableStream = closure(options);

options is a map of flags to invoke the compiler with. Options accepts one additional key jar, which can be a string path to a Closure Compiler jar file - use this to override the version of Closure Compiler to use.

To specify modules use the following schema:

module: [
  ['module_name:#files:deps:', 'sourceFile1.js', 'sourceFile2.js']

which would be outputted as the flags:

--module module_name:#files:deps: --js sourceFile1.js --js sourceFile2.js

Returns a Writable stream.