diff --git a/README.md b/README.md index 0e421cd..2f18d0e 100644 --- a/README.md +++ b/README.md @@ -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; @@ -116,7 +115,6 @@ Development defaults: ```javascript development.cache = 'dynamic'; -development.precompile = false; development.minify = false; development.gzip = false; development.debug = true; @@ -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): diff --git a/lib/settings.js b/lib/settings.js index ef0d56e..510e856 100644 --- a/lib/settings.js +++ b/lib/settings.js @@ -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; @@ -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); diff --git a/test/index.js b/test/index.js index 190f3e8..a0fe09b 100644 --- a/test/index.js +++ b/test/index.js @@ -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 @@ -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, @@ -454,4 +452,4 @@ describe('options.bundleExternal= false', function () { done(); }); }); -}); \ No newline at end of file +}); diff --git a/test/settings.js b/test/settings.js index 162d181..a766b18 100644 --- a/test/settings.js +++ b/test/settings.js @@ -163,8 +163,7 @@ describe('settings', function () { cache: false, minify: false, gzip: true, - debug: false, - precompile: false + debug: false }); settings.mode = 'development'; });