Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minifying html, js and css #25

Open
inquam opened this issue Jul 6, 2016 · 2 comments
Open

Minifying html, js and css #25

inquam opened this issue Jul 6, 2016 · 2 comments

Comments

@inquam
Copy link

inquam commented Jul 6, 2016

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

@JayXon
Copy link
Owner

JayXon commented Jul 6, 2016

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.

@JoeUX
Copy link

JoeUX commented Aug 18, 2016

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.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants