Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ Production defaults:

```javascript
production.cache = true; // equivalent to "public, max-age=60"
production.precompile = true;
production.minify = true;
production.gzip = true;
production.debug = false;
Expand All @@ -116,7 +115,6 @@ Development defaults:

```javascript
development.cache = 'dynamic';
development.precompile = false;
development.minify = false;
development.gzip = false;
development.debug = true;
Expand Down Expand Up @@ -182,26 +180,6 @@ If cache is any other `string` it will be sent directly to the client.

**N.B.** that if caching is enabled, the server never times out its cache, no matter what the timeout set for the client.

#### precompile

The precompile setting enables bundles to be precompiled/built and readily cached immediately on server startup. This option is not available when using browserify with a directory. If `precompile` is set to `true`, the bundle will be compiled & cached at server start.

```javascript
// Precompile a browserified file at a path
app.get('/js/file.js', browserify('./client/file.js', {
cache: true,
precompile: true
}));

// Precompile a bundle exposing `require` for a few npm packages.
app.get('/js/bundle.js', browserify(['hyperquest', 'concat-stream'], {
cache: true,
precompile: true
}));
```

**N.B.** It only makes sense to use precompiling when caching is enabled. If caching is disabled, no precompiling will happen.

#### minify

If `minify` is `true`, UglifyJS will be used to minify the resulting code. This is `true` by default in production. If you set it to an object, the object will be passed to uglify-js as [options](https://github.com/mishoo/UglifyJS2#the-simple-way):
Expand Down
3 changes: 0 additions & 3 deletions lib/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,12 @@ exports.debug = false;

var production = exports.env('production');
production.cache = true;
production.precompile = true;
production.minify = true;
production.gzip = true;
production.debug = false;

var development = exports.env('development');
development.cache = 'dynamic';
development.precompile = false;
development.minify = false;
development.gzip = false;
development.debug = true;
Expand Down Expand Up @@ -100,7 +98,6 @@ function normalize(options) {
+ Math.floor(ms(options.cache.maxAge.toString())/1000);
}

options.precompile = !!options.precompile;
options.external = arrayify(options.external);
options.ignore = arrayify(options.ignore);
options.transform = arrayify(options.transform);
Expand Down
4 changes: 1 addition & 3 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ app.use('/file/beep.js', browserify(__dirname + '/directory/beep.js', {
}));
app.use('/opt/file/beep.js', browserify(__dirname + '/directory/beep.js', {
cache: true,
precompile: true,
gzip: true,
minify: true,
debug: false
Expand Down Expand Up @@ -108,7 +107,6 @@ app.use('/mod.js', browserify(['require-test'], {
}));
app.use('/opt/mod.js', browserify(['require-test'], {
cache: true,
precompile: true,
gzip: true,
minify: true,
debug: false,
Expand Down Expand Up @@ -454,4 +452,4 @@ describe('options.bundleExternal= false', function () {
done();
});
});
});
});
3 changes: 1 addition & 2 deletions test/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,7 @@ describe('settings', function () {
cache: false,
minify: false,
gzip: true,
debug: false,
precompile: false
debug: false
});
settings.mode = 'development';
});
Expand Down