-
Notifications
You must be signed in to change notification settings - Fork 29
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
PostHTML limitations for HTML minifying #99
Comments
PostHTML is kind of an AST parser and manipulator. Basically, it receives HTML string, converts into an AST tree (which will be processed by PostHTML plugins), then PostHTML will re-build HTML string based on processed AST tree. Since PostHTML plugins like htmlnano can't have access to See also #6. In that feature request issue htmlnano failed to remove attribute quotes since those quotes are added and controlled by PostHTML. |
It would be helpful if PostHTML provides a way for plugins to control For example, for #6, if a user doesn't configure |
An issue has been opened at PostHTML, to see if PostHTML Team willing to implement an API for plugins to control the behavior of posthtml-render. |
In #29 @SukkaW asked whether it's possible to remove closing tags in PostHTML since it'd produce an invalid HTML. Although I don't know the answer to that particular question, it raises a more important question.
PostHTML provides a very useful API and helps a lot in HTML processing, but we'll get to the point when not all minifications could be implemented due to its limitations (e.g., how it processed HTML and which transformations it supports). I see two possible solutions:
don't implement these minifications — optimal from the dev perspective (i.e., more clean and straightforward code), but not from the end-user perspective
implement them on top of PostHTML — the code would become messier and more complex, but HTML would get minified better.
Neither of them is good. So, what do you guys think?
The text was updated successfully, but these errors were encountered: