trullock / NUglify

NUglify is a HTML, JavaScript and CSS minification Library for .NET (fork of AjaxMin + new features)
Other
398 stars 80 forks source link

Multi-line output (pretty print) empty object declaration screws up formatting #239

Closed drwestco closed 3 years ago

drwestco commented 3 years ago

NUglifyApp, v1.13.6.

Input:

(function ()
{
    try
    {
        var a = {};
    }
    catch (ex)
    {
    }
})();

NUglifyApp -pretty:

(function()
{
    try
    {
        var a = {  }
}
catch(ex) {}
})()

Note two unnecessary spaces inside the object literal assignment. Note indentation level lost after the object literal assignment.

trullock commented 3 years ago

the object whitespace is probably a matter of taste, but the indentation is definitely a bug. Will investigate

drwestco commented 3 years ago

Yeah, the object whitespace is understandable. It's an artifact of a single-line object declaration with space between braces and object properties. In the case of no properties, having two spaces inside is a little odd.

trullock commented 3 years ago

Fixed in 1.13.7