-
-
Notifications
You must be signed in to change notification settings - Fork 273
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
SUGGESTION: Handle plan HTML #990
Comments
Thankyou for the proposal, and taking some time out to submit it so thoroughly! I agree that the GoLand plugin experience is still sub-optimal, this is mainly down to the core maintainers not using GoLand so struggling to prioritise work in that area. I can understand the reasoning behind your proposal, you want to be able to write code in HTML files so that you can get the tooling that GoLand provides for HTML editing? One thing we'd need to consider carefully is how this change might impact existing templ tooling, there would be a trade-off there the use of the GoLand HTML tooling for editing would not provide autocomplete for go expressions within the template. My second thought on this is that the syntax you provided is very different to templ as it is. Our philosophy with the templ "language" is to introduce as little "templ" as possible, it should feel like a combination of go and html, so that it is familiar to new users. I think this change would introduce a separate templ language for people to learn as well as the Ideally we would improve the GoLand experience, if you have time to outline issues you are having with it in the issue tracker, or to give a 👍 on any issues that you are experiencing, it'll help us prioritise the problems. |
I appreciate your response. I have not tried the tooling in Vscode so I cannot comment. I was thinking this would be a more generic solution. My proposal for the "elements" was because I have already developed a quick Proof of concept that takes the html and generates a templ file. I also think we could so something like Please understand this is not a criticism of the development done for the Goland Plugin. It was more about there is way more tooling for HTML and even HTML with "templating" languages than the other way around :) My other suggestion which I havent explored alot would be what if we had an {{include "filename.html"}} and it will include the file as if it was inline this way the templ language doesn't change and I can use other tooling on the HTML template. What are your thoughts on that? Please understand, I am only trying to make this better. I think this will be a key go tech especially with htmx developers. |
I think this project is getting a lot of traction in the Go community, especially for HTMX
As a GoLand user the experience is not the best (Sorry, I appreciate the effort)
What I think would be ideal is if we can write "plain" HTML as much as possible. ie without the "templ" code before and after the actual template. I think what we have already works well and is still required.
I have 2 suggestions
Where
hello.html
has plain html with templ mark in it ieThis means we can define the imports and the parameters etc as we can now but we can also have our IDE handle the file as a normal HTML with whatever templating code is in there.
I am not sure what the best syntax is but a suggestion would be something like this:
My initial proposal is we have some "templ" elements that we can "find" using "golang.org/x/net/html" and process.
The
templ:import
would be used to create Imports in the Go Code and thetempl:param
would be used to add params to thetempl
function. We could use the directory name for the package name or add atempl:package
and the function name could be the file name or again add atempl:func
etc.This could be pre-processed into a
templ
file ieI am not sure how this fits with your philosophy for templ but I am hoping I might have some ideas in here that make sense.
Or maybe I am trying to convert this into something else. I could not find another issue that mentions anything like this so I hope I m not rehashing something that has already been discussed.
The text was updated successfully, but these errors were encountered: