-
Notifications
You must be signed in to change notification settings - Fork 2
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
Why bother with template directives? #25
Comments
Hey there @cowwoc! What "normal" java code generates and returns HTML? Like a different template engine? Undead uses StringTemplate mostly because it is a templating engine that makes it easy to get the data structure we need. Most other template engines don't provide access to the "raw" data structures behind the templates themselves - rather they just return the rendered string which isn't what we need. The template directives are completely optional so there is nothing stopping you from using embedded expressions in your StringTemplates. That said, StringTemplate-based HTML templates are so new that I think it is worth experimenting with tools that might make them easier to build. I'd suggest you try them out more extensively and see what you think. Maybe compare / contrast some template examples? I don't understand your point re: React Remix. Remix is a javascript-based framework which is a completely different language than Java with different package manager, build chain, etc. The idea with Undead is you only need to write Java. No javascript. No FE vs BE, etc... |
Happy to continue convo but closing the issue. |
Forgetting the programming platform for a second, Remix lets you build up an HTML document using Javascript code. Example: https://stackoverflow.com/q/77306709/14731 or You can literally build up the HTML script using the full power of Javascript or calculate values in JS and embed them using I have nothing against embedding simple values in code (e.g. |
Hey @cowwoc. Remix's own tutorial has JSX (and TSX) utilize boolean logic and looping (via Most (all?) template languages have ways to implement boolean logic and loops at a minimum. Again, you don't have to use the directives in |
Instead of trying to recreate a programming language using template directives, why not just use normal Java code to generate and return HTML code? This is what React Remix does and it's way easier to use and read.
The text was updated successfully, but these errors were encountered: