I'd be concerned that the beautifier might break our code.  In my experience, 
every compressor we tried did.  Which is why we wrote our own.

Also, I thought that Firebug had something like this built in (and that it even 
prettifies compressed code)?

On 2011-06-08, at 06:43, Raju Bitter wrote:

> What's more readable? Even if it's "only" the indentation...
> 
> Original JS code:
> /* -*- file: compiler/Class.lzs#150 -*- */
> Instance.prototype.addProperty("nextMethod", (function () {
> /* -*- file: #150 -*- */
> var $lzsc$temp = function  (currentMethod, nextMethodName) {
> var next_$0;
> if (currentMethod.hasOwnProperty("$superclass")) {
> next_$0 = currentMethod.$superclass.prototype[nextMethodName]
> } else if (currentMethod.hasOwnProperty("$superclasses")) {
> var $1 = currentMethod.$superclasses;
> for (var i_$2 = $1.length - 1;i_$2 >= 0;i_$2--) {
> var sc_$3 = $1[i_$2];
> if (this instanceof sc_$3) {
> next_$0 = sc_$3.prototype[nextMethodName];
> break
> }}};
> 
> Beautified:
> Instance.prototype.addProperty("nextMethod", (function() { /* -*-
> file: #150 -*- */
>    var $lzsc$temp = function(currentMethod, nextMethodName) {
>            var next_$0;
>            if (currentMethod.hasOwnProperty("$superclass")) {
>                next_$0 = currentMethod.$superclass.prototype[nextMethodName]
>            } else if (currentMethod.hasOwnProperty("$superclasses")) {
>                var $1 = currentMethod.$superclasses;
>                for (var i_$2 = $1.length - 1; i_$2 >= 0; i_$2--) {
>                    var sc_$3 = $1[i_$2];
>                    if (this instanceof sc_$3) {
>                        next_$0 = sc_$3.prototype[nextMethodName];
>                        break
>                    }
>                }
>            };
> 
> On Wed, Jun 8, 2011 at 2:12 PM, P T Withington <[email protected]> wrote:
>> The compiler does not "uglify" the JS code when compiled in debug mode, so 
>> there should not be any need to beautify.  "Uglification" (compression, 
>> obfuscation) should only happen when you are running in non-debug mode.
>> 
>> On 2011-06-08, at 04:45, Raju Bitter wrote:
>> 
>>> Have you ever thought of beautifying the generated JavaScript code in
>>> debug mode for the DHTML runtime? It would make the code a lot more
>>> readable when debugging the DHTML runtime. Same is true for the
>>> LFCdhtml-debug.js.
>>> 
>>> A good tool would be https://github.com/einars/js-beautify
>> 
>> 


Reply via email to