diff --git a/bin/builder.js b/bin/builder.js index 4e319dd..3c9a607 100755 --- a/bin/builder.js +++ b/bin/builder.js @@ -209,11 +209,18 @@ var builder = module.exports = function () { // check if we need to process it any further if (settings.minify) { + // uglify hate uncode chars... + var separator = '@@OMGYUCHANGEME@@@'; + code = code.replace(/(\\ufffd)/g, separator); + var ast = uglify.parser.parse(code); ast = uglify.uglify.ast_mangle(ast); ast = uglify.uglify.ast_squeeze(ast); code = production + uglify.uglify.gen_code(ast); + + // restore the code + code = code.replace(new RegExp('('+ separator + ')', 'g'), '\\ufffd'); } callback(error, code);