Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added instructions for how to use nailgun to run the closure compiler #77

Merged
merged 3 commits into from Nov 17, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 28 additions & 0 deletions README.md
Expand Up @@ -275,6 +275,34 @@ gulp.task('js-compile', function () {
});
```

## Running the compiler using nailgun
This gets around the long startup time of Google Closure Compiler using Nailgun, which runs a single java process in the background and keeps all of the classes loaded.

First you need to install closure-gun by running the following command.
```bash
npm install closure-gun
```

### Gulp
```js
var compilerPackage = require('google-closure-compiler');
var closureCompiler = compilerPackage.gulp();

compilerPackage.compiler.JAR_PATH = undefined;
compilerPackage.compiler.prototype.javaPath = './node_modules/.bin/closure-gun'
```

Note that when using gulp, Only without gulp.src works with nailgun.

### Grunt
```js
var compilerPackage = require('google-closure-compiler');
var closureCompiler = compilerPackage.grunt();

compilerPackage.compiler.JAR_PATH = undefined;
compilerPackage.compiler.prototype.javaPath = './node_modules/.bin/closure-gun'
```

## Specifying Extra Java Arguments
Some users may wish to pass the java vm extra arguments - such as to specify the amount of memory the compiler should
be allocated. Both the grunt and gulp plugins support this.
Expand Down