From 547522a59edf46d927496d9172c96b497e65c762 Mon Sep 17 00:00:00 2001 From: "Nicholas C. Zakas" Date: Thu, 23 Apr 2015 13:13:42 -0700 Subject: [PATCH] Fix embedded sourcemap URL (fixes #31) --- Makefile.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Makefile.js b/Makefile.js index 0a7283a..9d303d0 100644 --- a/Makefile.js +++ b/Makefile.js @@ -13,9 +13,11 @@ require('shelljs/make'); var util = require('util'), + path = require('path'), nodeCLI = require('shelljs-nodecli'), semver = require('semver'), - dateformat = require('dateformat'); + dateformat = require('dateformat'), + uglifyjs = require('uglify-js'); //------------------------------------------------------------------------------ // Data @@ -244,8 +246,14 @@ target.dist = function() { (versionComment + copyrightComment + cat(TESTING_FILES)).to(distTestingFilename); // create minified version with source maps - nodeExec('uglifyjs', distFilename, '-o', minDistFilename, - '--source-map', minDistSourcemapFilename, '--comments', '"/^!/"'); + var result = uglifyjs.minify(distFilename, { + output: { + comments: /^!/ + }, + outSourceMap: path.basename(minDistSourcemapFilename) + }); + result.code.to(minDistFilename); + result.map.to(minDistSourcemapFilename); // ensure there's a newline at the end of each file (cat(distFilename) + '\n').to(distFilename);