From b3455abcb9e29453c2c0633fb142265506d77731 Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Mon, 23 May 2011 18:32:07 -0400 Subject: [PATCH] Added notice in the event that UglifyJS is unavailable --- tools/minify.js | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/tools/minify.js b/tools/minify.js index e8ca5db..947d32f 100644 --- a/tools/minify.js +++ b/tools/minify.js @@ -6,11 +6,29 @@ */ // uses UglifyJS -var parser = require( 'uglify-js' ).parser, - uglify = require( 'uglify-js' ).uglify, +var uglify, + FILE_ROOT = '../build/'; - FILE_ROOT = '../build/' -; +try +{ + // attempt to load UglifyJS + var uglify = require( 'uglify-js' ); +} +catch ( e ) +{ + // if there's a problem loading it, let the user know what they probably + // need to do + process.stderr.write( + "Unable to located UglifyJS. Please run:\n\n" + + " $ npm install uglify-js\n\n" + + "and then try again.\n" + ); + + process.exit( 1 ); +} + +var parser = uglify.parser, + uglify = uglify.uglify; // we should receive the file via stdin var data = '';