-
Notifications
You must be signed in to change notification settings - Fork 124
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
Convert Template function to class #2148
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting changes proposed!
Curious if there are opportunities here to improve the code further. For example, I wonder whether template.js
really needs to be in this folder, or perhaps it is more suited in the Site
folder. What do you think?
On one hand, I think keeping But on the other hand, I also see the benefit in moving it over to the Yes, I think moving it over may make more sense than keeping it where it currently is. |
Update in 931271a:
As the template files reside in another directory outside |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am wondering if it would be a good idea to additionally move all the template files into the
packages/core/src/Site
folder to make it more direct, or if it would make more sense to keep the template in a separate folder as is currently being done. I would appreciate thoughts on this matter as I am uncertain if this makes sense 👍
I think leaving them there is fine, because of how they are used and also that in the future, that folder can potentially grow further in the event that we increase the number of templates supported.
As for the shift of template.js
I was wondering if that causes any cyclic dependency, which doesn't seem to be the case so we should be good.
Lastly, I don't like how we have a "pass-through" method initSite
that simply calls new Template().init
, which feels like a red flag in the class design. Might need further refactoring in the future.
LGTM.
What is the purpose of this pull request?
Overview of changes:
Resolves #2147.
Converts the
Template
function insidepackages/core/template/template.js
into a class.This also simplifies the migration process for
template.js
into TypeScript in #2143.Anything you'd like to highlight/discuss:
Testing instructions:
Proposed commit message: (wrap lines at 72 characters)
Convert Template function to class
Checklist: ☑️