-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Replace Hogan with Web Components #2751
Comments
I like the idea, it's pretty interesting! Honestly, I'm not too familiar with I'm curious about how much change you anticipate in terms of JS and the templating aspect. I ask mostly because as you have seen, the generated report is self-contained, so I try to keep it as lean as possible. That said, I do prioritize all these improvements. |
I should have a demo up in the next couple days. I decided to pull it out into a separate ARIA patterns repo since that'll make it easier to work with, and I want to explore the patterns further anyway.
I think the final result would end up smaller, both in the number of files as well as the total size. The changes could be integrated similarly to those proposed in #2742; the refactoring to ES6 syntax can happen separately from Hogan's removal, so that things are replaced slowly, with caution and intention. I think lots of JavaScript could disappear, or at the very least be consolidated into a flexible base for each section. There's not a single part of me that thinks the report would come out heavier than before. I'll work on cleaning up #2750, as I don't think it's worth doing any code tinkering related to this until the outstanding semantic stuff is merged. |
Another thing I haven't mentioned yet is that this and the semantic work will open up the opportunity to refactor the CSS as well. I've intentionally avoided doing so on the semantic work unless necessary, but custom properties would make theming more straightforward, and the semantic HTML would allow further consolidation of the custom CSS; that'd slim things down even more. I think that Bootstrap could even be removed completely, but I'm not certain until we examine the specifics of the other proposed work further; I removed quite a few utility classes in the semantic work so far, so it doesn't feel too implausible. |
That would be fantastic, especially if it can be done natively, to keep things as lightweight as possible.
That sounds great too! I'm sure there are some unused parts, and I've been trying to run it through a CSS coverage tool to identify what can be cleaned up.
I wonder if upgrading to a newer version of Bootstrap or switching to Tailwind would bring any benefits. What are your thoughts? |
Hogan.js, the Mustache compiler used for generating the HTML report, has been marked as unmaintained for almost three years now; changing compilers or templating languages altogether seems to be a prudent move no matter what, and utilising the Web Components standard would remove Hogan as a dependency without the need to replace it with any other external code.
This is obviously a massive undertaking, but I think the reward makes the effort worthwhile. For a start, the existing Hogan templates could be converted to
<template>
elements fairly quickly, and I've plenty of WebComponent experience from my ProseMirror plugin work. (prosemirror-plugin-outline
implements the WAI-ARIA treegrid pattern, and a large chunk of that code could be applied here to improve the accessibility of GoAccess's data tables, addressing part of #2742. I can spin up an example page for that if you'd like, but the relevant web component code is in ProseMirrorOutline.component.js.)Simplifying the panel creation process would not only speed up HTML report feature development in the long-run, it would also allow those interested in different or more flexible data views—#714, #1079, #2238, #2485, #2642, #2654, #2687, #2731, #2740—to create them independently and with relative ease, either for personal use or as part of a pull request.
Ideally, this new templating approach would mean that a static HTML report—as discussed in #685—could be generated with very large tables, and those tables would be ingested by the custom elements for generating the charts and other dynamic elements.
I'd be able to start investigating this further in a week or two, though I know you are currently working on some of the filtering issues mentioned above, and I don't want to impede that work in any way. Let me know if this is seems interesting, and I can attempt to assuage any nerves by discussing some example approaches in more detail.
The text was updated successfully, but these errors were encountered: