-
Notifications
You must be signed in to change notification settings - Fork 137
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
The future of j2html #172
Comments
Hi, I suggest to move the current |
Is it currently possible to add CSS pseudo-classes to HTML elements through j2html? |
You can specify your pseudo-classes in the usual style tag:
Pseudo-classes and pseudo-elements cannot be declared inline on elements using the style attribute if that is what you are asking. That's due to the HTML spec., not j2html. |
At a glance I don't see anything wrong with those PRs. I'll review and merge shortly. Thanks! |
Hello, I am aware that this project is switching maintainers so you might not have an answer for some of these Release ProcessI am wondering if you guys have a general idea for the release process. I have a project that uses j2html pretty heavily for the UI and I am currently displaying trailing commas in several places. You guys have merged the fix #168, so I am wondering when I can expect to consume the new version now that it is merged. The last release was in 2019, so it seems like maybe there isn't any scheduled release mechanism in place yet. Updating DependenciesI have noticed that the latest release for this project was in 2019, which seems problematic because it means that dependencies are probably not being updated. For this to be a worthwhile dependency for consumers, it for sure needs to be up to date with all security fixes, and it is also nice if it can be running the latest versions of things where possible. Github has a mechanism called dependabot that can automatically update your dependencies that might be worth while for you guys to look into. I maintain several repos that use it and it works pretty well for me. PR/Issue TemplatesWhen making a PR and an Issue for this project, I noticed that you guys didn't have any templates which makes it kind of questionable what the expectation is for getting something merged. I think you guys could improve the average quality of a PR or an issue if you went ahead and added some templates that layout what you need to do in order to expect your PR to merge/Issue to be addressed. You can also add for example "please review: @tipsy @sembler" so people can at the right people. I just guessed tipsy because its on his fork and he had written most of the code. |
Thanks for your input @sagesmith-wf . These are excellent ideas to move towards, and while you are right that I don't have answers for everything, here are my thoughts: Release ProcessI prefer frequent releases at regular intervals, such as a release every 2/3 months. As long as there are bug fixes or new features available to push out. Of course emergency releases for urgent bug fixes are always a possibility. Updating DependenciesFortunately, from the user's perspective, j2html doesn't have any compile or runtime dependencies on other libraries; and I aim to keep it that way. I've been burned by plenty of libraries with out-of-date transitive dependencies. But, going back to the release process, keeping dependencies up-to-date every few months should be adequate. Checking for updates to the Maven plugins and testing libraries is easy enough. PR/Issue TemplatesI have not had much experience with this, but anything that helps get us clear and consistent PR sounds great to me. I'll look at the documentation you linked, and see what other projects are doing. |
New Feature IdeasI don't know if you guys are planning any new features but here is a list of things I would use if they existed Templated HTMLI would like to be able to do something like Django but with the built in type safety of java. It'd be nice to be able to stub out the static parts of the html and only have code for what is going to change depending on the input instead of having to visualize the entire html doc through chained method calls Style methods off of the dom objectsIt would be nice if the for example body(
// other dom content)
.color(Color.fromHex("#FF0000")
.font(Font.fromFile("some path"))
//etc Default subroutines for certain dom contentA lot of what I am doing which this library is displaying various data structures in some fashion. It would be pretty neat to make some of the methods able to handle some of the common usecases ex: Displaying a listList<String> myList = List.of("1", "2", "3", "4");
ul(myList);
Map<String, List<String>> myMap = Map.of(
"1", List.of("a", "b", "c"),
"2", List.of("d"),
"3", List.of("e", "f")
"4", List.of());
ul(myMap);
Rendering HTMLThe render function being chained to the actual dom content calls feels a bit unexpected when using this library. I feel like it makes this library a lot less discoverable than simply funneling everyone in through some entrypoint . Maybe something like: HTMLWriter.write(OutputStream out, DomContent content); Custom DataobjectsIt'd be really handy to be able to just pass a data object for some of these things and have single reusable object that you can just set the data for. This becomes really useful when it gets really deeply nested structures that you need to swap out the data for and you don't want to think about the output. Ex:
Template template = ul("k", li("k2"));
template.render(Map.of(
"k", List.of(1, 2),
"k2", List.of(a, b)); You can take this concept really far and do the whole jackson getter thing to if you want, so something like: class MyPojo {
private String k;
public String getK() {
return k;
}
}
Template template = ul("k");
MyPojo p = new Pojo("1);
template.render(p); Simple WebServerI don't think this is super necessary for the core library, but something that brought in for example jetty that made it super easy to get a functioning server running with this code I think this would have a chance at being a pretty widely used library. |
Hi @sagesmith-wf, I think the cool thing about j2html is that it is both simple and extensible. So, concerning (some of) your ideas: Style methods Actually, I would always use an inline css
And this Default subroutines for certain dom content Same here - I wouldn't add these methods to j2html (to keep the j2html API rather compact), but nothing is stopping you from defining your own static methods in your project that do all the things you need. This is what I mean with extensible. At least I have such methods in my project that uses j2html. 😉 Nevertheless, I also miss some basic method like
Custom Data objects I wonder if we can use the Simple webserver Sounds to me as this could be a separate project/module. Just my 2 cents ... |
By the way, something that I am thinking about is to use/extend j2html to create SVG. |
Between the suggestions here and some of my own thoughts lately, I'm seeing that making a new release should be our first priority. This month if possible @tipsy. Following that I'd like to suggest something painful and mundane... we update the documentation and website. As not-fun as that might be, I've come to realize that we need to more clearly communicate the nuances and capabilities of this library. The example page is a good overview, but doesn't fully explain many of the design ideas behind the API (or warn against the wrong way to do things, as we so often see in the project issues page) and doesn't even touch on the deeper features like custom But don't let that put you off from adding more suggestions! Let's consider them to be part of v2.0 (because they'll probably involve breaking changes) and keep exploring possibilities. Some of the smaller changes like helper methods should be possible to integrate before v2.0. |
Just ping me when you want me to release. Is the master branch back to being non breaking now? |
There is still the special |
One more thought for @sagesmith-wf ...
I strongly agree that there should be a new release pretty soon, but do you realize, that you can temporarily fix the trailing comma behavior in your own code? It's a static method that contained this bug, all you have to do is to create your own version of this method and use it instead of the j2html version. ✌️ |
I've opened a new issue to discuss the |
I'd like to drop one last PR in a few minutes. But after that, YES! |
I ran into Edit2: This is probably more accurate: https://stackoverflow.com/a/17639344/7916291 Edit3: Seems to be fixed! Edit4: Getting Edit5: Something funky is going on with the release plugin. Edit6: 14th time's the charm! |
Awesome! Big thanks to you and Oliver! That's a small surprise to round off the day. I hadn't considered method references that much before, but we can take them into account going forward. |
Adding my 2 cents, is there any consideration for the handling of WebComponents which would require defining custom HTML Tags? |
@Ordiel Yes there is. At the moment defining your own HTML tags is easy enough using |
Sorry I didn't noticed this on my notifications, I'll have to play around a bit more with whats already there to find out its current limitations, I'll be sure to add my comments here, I've been a lurker of j2html for a while and I just got myself to put it to use a few weeks back (with the intent of creating the content of a library intended to dynamically create web components) so far it has been great yet I as you mentioned I noticed the lack of those two tags. I'll do my homework and provide feedback |
This issue is for disussing both the short term (next release) and long term (2.x release with API changes) to the project.
The text was updated successfully, but these errors were encountered: