Comments (8)
Closing this, as i created j2htmx to extend for now
from j2html.
I've heard good things about htmx. To start I'd look at the Tag::attr
methods to see if those meet your needs. They'll allow you to add any attribute you could want, without needing to extend any existing classes.
If you're interested in adding logic behind a Tag you could extend the ContainerTag or EmptyTag classes for whatever you need. It is also possible to create your own classes that provide custom rendering by implementing DomContent and the render(HtmlBuilder<T> builder, Object model)
method.
from j2html.
Id love it if I can extend the base classes and make it part of j2html to boot
Edit : my original plan was to create new versions of each tag BTW, this would save me a lot of effort
from j2html.
I think it would need to be distributed as a separate Jar, and I'd expect there to be many changes under the hood as we progress towards version 2.0.
from j2html.
I Dont mind doing it like that, by extending each base class. But should this be in this repo or another repo?
Edit: Looking at this code base, I can probably use some regex magic and create 2 versions of the library, one with the HTMX tags(which are available for all container tags) and one without. Would that work?
from j2html.
My initial impression from the htmx docs is that this is heavily focused on getting the correct content for the correct attributes. To that end I'd suggest starting by defining small utilities to do that instead of worrying about deep integration with existing classes. Like Attribute put = HX.put("/messages")
so that you can the use the attribute in J2html div().attr(HX.put("/messages"))
to get <div hx-put="/messages"></div>
. As you expand on that support class you could add features towards the specific syntax that HTMX recognizes like hx-trigger="mouseenter once"
. If you end up still pursuing integration with J2html you'll have all of those utilities ready to use behind the scenes.
from j2html.
I went ahead and did that https://github.com/TareqK/j2htmx
from j2html.
Thanks @TareqK ! This looks really nice. I like where you are going with your examples.
from j2html.
Related Issues (20)
- Change package root to com.j2html
- Fix document(HtmlTag) in TagCreator HOT 1
- j2html website HOT 5
- Version 1.5.0 release HOT 12
- render API simplification HOT 8
- Introduce API revision checks HOT 5
- Performance tuning HOT 2
- Adding style to html element HOT 1
- Question: New html-tags HOT 2
- The "accept-charset" attribute is missing from FormTag HOT 1
- [Question] How best to convert `Tag` for 1.5.0? HOT 2
- question for <code> tag HOT 2
- Fail to create <generate> and <command> tag HOT 3
- Escaped text issues of "#" and "$%" HOT 1
- Embedding SVG HOT 1
- How to solve encoding problem HOT 3
- Multiline titles using HOT 2
- MathML support HOT 3
- Extends ContainerTag HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from j2html.