trullock / NUglify

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

Minify internal JS class helper method properties #278

Open mattscotty opened 3 years ago

mattscotty commented 3 years ago

I've just been looking at the minified output from a class I've just wrote and it seems the internal property names are not being minified. If they're an internal function (not accessible externally), its possible these could be minified to single letters too. An example is as follows;

` const ExampleA = (function () { class exampleA extends HTMLElement { constructor() { super(); }

        connectedCallback() {
            this.exampleMethod();
        }

        exampleMethod() {
            function helperMethod(opts = { opt1, opt2, opt3, opt4, opt5 }) {
                //Do something
            }

            helperMethod({
                opt1: 'Example1',
                opt2: 'Example2',
                opt3: 'Example3',
                opt4: 'Example4',
                opt5: 'Example5'
            });
        }
    }

    customElements.define('example-a', ExampleA);

    return exampleA;
}());

`

From what I can tell, both the declarations in helperMethod, and usage of those properties (e.g. opt1, opt2...), could be minified(?)