Open mattscotty opened 2 years ago
This can probably be achieved with some tweaking of how the current HTML settings works - and maybe some new options as you suggest.
We'd need to go down the current behaviour and decide which things it should/shouldnt do by default and then what options are appropriate
Agree, my initial test used the following;
Uglify.Html(File.ReadAllText(xmlFile.FullName), new NUglify.Html.HtmlSettings
{
RemoveAttributeQuotes = false,
RemoveOptionalTags = false
}).Code
The main issue I encountered was that tag names were converted to lower case with no way to disable this, though other testing would obviously be required.
There are possible performance settings that may be on by default too, e.g.;
//No JS or CSS should be present so can be disabled for performance(?)
MinifyJs = false,
MinifyCss = false,
For the moment I've had to revert to another solution, but my preference would to be consistent and use Nuglify if we can tweak it a little.
For context, I did a test on a 646KB XML file and using the alternative solution, this was brought down to ~521KB, so a worthwhile saving. My Nuglify test was around that mark too (though with lower case tags, which my third party app was not able to handle).
Make a separate issue to control tag Name and attribute lowercasing and we'll address that first
Note that NUglify wont lower-case tag names if they have an XML namespace
XML minification can help by removing whitespace. However on testing using the HTML minifier, tags do not retain their case sensitivity and there is no option to do so (there is for the attributes).
The suggestion is to add an XML mode, e.g. Uglify.Xml() (as we have HTML, JS and CSS) and / or the ability to keep the case of tags within HTML.