job-board icon indicating copy to clipboard operation
job-board copied to clipboard

[DX] rename static files that are templates

Open gedw99 opened this issue 2 years ago • 6 comments

In https://github.com/golang-cafe/job-board/tree/master/static/views it’s hard to see what’s a reused template and what’s a complete html page.

Can we just rename all template ones to start with a prefix if “tpl_” ?

the refactor is a simple find and replace from what I can see .

This will make it alot easier to work on and extend and is not disruptive to the rest of the architecture

gedw99 avatar Apr 22 '23 08:04 gedw99

Agreed.

but I would not create sub folder but instead use file name prefixes. It’s a sneaky form of tagging . You can do it for css too as you mentioned.

why though ?

because file hierarchies make templates more complex with subtle bugs. It can get nasty pretty fast .

I feel it’s yagni!

For example , the pkg folder is nicely one folder per service and it’s why it’s so easy to grok the system.

Maybe I am wrong because I am not close enough t the code base but it’s just my hunch from over the years.

We could do it in 2 phases.

  1. File prefix in same folder
  2. see the patterns and see what could be in its own folder later

gedw99 avatar Apr 23 '23 05:04 gedw99

I agree with @gedw99 , in case we have to create folder, we should think of it as a module wise, for eg: keeping all html and templates of let's say developer module in a folder of its own.

As v1, we should at-least attach prefix to all templates html.

sareensumanau avatar Apr 23 '23 10:04 sareensumanau

I'm working on this.

jemiluv8 avatar Apr 23 '23 14:04 jemiluv8

There were only three template files and they were all suffixed with -template. So perhaps I thought there was some sort of "indicator" already as to whether it was full page or reused template.

I also thought "tpl-" might be more consistent with the file naming convention in the static/views folder (instead of tpl_).

But I went ahead with the changes as discussed. Awaiting feedback ...

jemiluv8 avatar Apr 23 '23 15:04 jemiluv8

we already have -template suffix, if we have to do any change at all to the templating structure it will be subfolders, otherwise there is no point in investing time on this

ghost avatar Apr 23 '23 18:04 ghost

Yeah I agree. So do we decline the PR? Since its redundant?

jemiluv8 avatar Apr 23 '23 18:04 jemiluv8