golang-cafe / job-board

Golang Cafe - Go job board with no recruiters and clear salary ranges
https://golang.cafe
BSD 3-Clause "New" or "Revised" License
208 stars 50 forks source link

[DX] rename static files that are templates #101

Open gedw99 opened 1 year ago

gedw99 commented 1 year ago

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 commented 1 year ago

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
sareensumanau commented 1 year ago

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.

jemiluv8 commented 1 year ago

I'm working on this.

jemiluv8 commented 1 year ago

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 ...

ghost commented 1 year ago

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

jemiluv8 commented 1 year ago

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