Skip to content

Commit

Permalink
add option to disable bundle minification
Browse files Browse the repository at this point in the history
  • Loading branch information
jasoncalabrese committed Dec 20, 2016
1 parent 218b00a commit 5e8d15c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ To learn more about the Nightscout API, visit https://YOUR-SITE.com/api-docs.htm
* `SSL_CERT` - Path to your ssl cert file, so that ssl(https) can be enabled directly in node.js
* `SSL_CA` - Path to your ssl ca file, so that ssl(https) can be enabled directly in node.js
* `HEARTBEAT` (`60`) - Number of seconds to wait in between database checks
* `DEBUG_MINIFY` (`true`) - Debug option, setting to `false` will disable bundle minification to help tracking down error and speed up development


### Predefined values for your browser settings (optional)
Expand Down
2 changes: 1 addition & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function create (env, ctx) {
// serve the static content
app.use(staticFiles);

var bundle = require('./bundle')();
var bundle = require('./bundle')(env);
app.use(bundle);

// Handle errors with express's errorhandler, to display more readable error messages.
Expand Down
5 changes: 3 additions & 2 deletions bundle/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

var browserify_express = require('browserify-express');

function bundle() {
function bundle(env) {
console.info('>>>debug', env.debug);
return browserify_express({
entry: __dirname + '/bundle.source.js',
watch: __dirname + '/../lib/',
mount: '/public/js/bundle.js',
verbose: true,
minify: true,
minify: env.debug.minify,
bundle_opts: { debug: true }, // enable inline sourcemap on js files
write_file: __dirname + '/bundle.out.js'
});
Expand Down
3 changes: 3 additions & 0 deletions env.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ function config ( ) {
env.HOSTNAME = readENV('HOSTNAME', null);
env.IMPORT_CONFIG = readENV('IMPORT_CONFIG', null);
env.static_files = readENV('NIGHTSCOUT_STATIC_FILES', __dirname + '/static/');
env.debug = {
minify: readENVTruthy('DEBUG_MINIFY', true)
};

if (env.err) {
delete env.err;
Expand Down

0 comments on commit 5e8d15c

Please sign in to comment.