From c1816a292f6649e70e6781ecc3269c03b6efe913 Mon Sep 17 00:00:00 2001 From: rr- Date: Thu, 7 Apr 2016 18:51:29 +0200 Subject: [PATCH] client/build: don't minify JS for debug build --- client/build.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/client/build.js b/client/build.js index 70e63e5..efbe649 100644 --- a/client/build.js +++ b/client/build.js @@ -95,15 +95,17 @@ function bundleCss() { }); } -function bundleJs() { +function bundleJs(config) { const browserify = require('browserify'); const uglifyjs = require('uglify-js'); glob('./js/**/*.js', {}, function(er, files) { const outputFile = fs.createWriteStream('./public/bundle.min.js'); browserify().add(files).bundle().pipe(outputFile); outputFile.on('finish', function() { - const result = uglifyjs.minify('./public/bundle.min.js'); - fs.writeFileSync('./public/bundle.min.js', result.code); + if (!config.debug) { + const result = uglifyjs.minify('./public/bundle.min.js'); + fs.writeFileSync('./public/bundle.min.js', result.code); + } console.info('Bundled JS'); }); }); @@ -122,5 +124,5 @@ const config = getConfig(); bundleConfig(config); bundleHtml(config); bundleCss(); -bundleJs(); +bundleJs(config); copyFile('./img/favicon.png', './public/favicon.png');