Leanify icon indicating copy to clipboard operation
Leanify copied to clipboard

Minifying html, js and css

Open inquam opened this issue 7 years ago • 2 comments

Minifying html, js and css would be a nice feature to add to Leanify.

inquam avatar Jul 06 '16 10:07 inquam

Yes, I would love to add those. The problem is, I don't want to reinvent the wheel to implement yet another html/js/css minifier (I also don't have enough knowledge about these formats to do it), but existing good minifiers (html-minifier, UglifyJS2, csso) are written in javascript. If anyone know any good C/C++ implementations (low-level parser that support both read/write would also be very helpful), please let me know. Or, if anyone have good knowledge of these formats are willing to implement it in C/C++, I'm happy to help.

For now, Leanify can only optimize embedded images in Data URI in these files, which I don't think any of those existing minifiers can do. So you probably want to use an existing good minifiers and Leanify together to get the best possible result.

JayXon avatar Jul 06 '16 19:07 JayXon

Count me as another supporter of this idea. It would be awesome if you added web minification to Leanify. The XML minification you already do is pretty good, and made a big difference in File Optimizer for SVGs compared to HTML Tidy.

Yes, there are minifiers out there already, but there may be room for improvement. I'm seeing some dangerous bugs where content gets deleted. I don't know of a C or C++ implementation, but I know of one in Go and another in C# – these might be easier to navigate than JS, and C# is fairly similar to C/C++.

Mads' C# implementation: key source is in this folder.

Taco de Wolf's go implementation is here. He's deleting "unrequired" tags like html, head, and body, which is completely insane, but I'll talk to him when he gets back from vacation. (The HTML spec says that user agents should automatically infer those tags, but no one treats them as optional – we need them for all sorts of purposes, like metadata, Open Graph, etc.)

JoeUX avatar Aug 18 '16 02:08 JoeUX