WEBUILDER_SCRIPTS['WB_EXEC_UGLIFYJS'] = function(data1, data2) {
  if (data1 == 'WB_EXEC_UGLIFYJS') {
    
    var lines = data2.split('\n');
    var txt = lines.join('\n');
    
    try {
      var res = minify(txt, { output: { max_line_len: 240 }});
      var errmsg = '';
      var response = '';
      if(res.error) {
        var errmsg = 'Minfiying error';
        if (res.error.message) {
          errmsg = res.error.message;          
        }
        if (res.error.line) {
          errmsg = "(" + res.error.line + ")" + errmsg;          
        }        
      } else {
        response = res.code;
      }
      WeBuilderData.SendNative("WB_EXEC_UGLIFYJS_RESULTS", response, errmsg);
    } catch(error) {
      var errmsg = "" + error;
      WeBuilderData.SendNative("WB_EXEC_UGLIFYJS_RESULTS", '', errmsg);
    }
  }
}