-
Can we have the generated code mapped to a separate directory? For example: |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
This has been asked for before, but I've never really understood why anyone would want it other than for aesthetic reasons of not liking that the files are next to each other, or, IIRC to avoid having to configure a hot reload tool. In Go, the directory structure defines the package, and at the moment, the process for finding the matching Go file from a templ file is to change .templ to _templ.go. With a directory option, it would be a bit more complex, and also, any developer coming to a project couldn't rely on So, currently, my thinking is to not add the option, since it makes the code more complex to maintain, opens up a vector for bugs, and doesn't have any clear benefits. If there's a killer use case, I'd always reconsider, but I'd rather spend my time on CSS handling, which I think could be improved in templ. |
Beta Was this translation helpful? Give feedback.
-
That is really going to mess with Go, as your package names will all be in the same folder. If the goal is to hide the generated files, if your using Visual Studio Code, go to Settings, Search "Hide" and enter the below pattern. Pattern:
|
Beta Was this translation helpful? Give feedback.
-
In the templ channel in the Gopher's Slack, Ali Yeysides said you can also use a vim command to hide the generated files: function HideFiles()
vim.cmd [[let g:netrw_list_hide.=',.*_templ.go']]
end
HideFiles() |
Beta Was this translation helpful? Give feedback.
That is really going to mess with Go, as your package names will all be in the same folder.
If the goal is to hide the generated files, if your using Visual Studio Code, go to Settings, Search "Hide" and enter the below pattern.
Pattern: