-
Notifications
You must be signed in to change notification settings - Fork 10
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
Rfc/issue 182 template hooks #189
Conversation
www/pages/plugins/hooks.md
Outdated
<meta name='apple-mobile-web-app-capable' content='yes'/> | ||
<meta name='apple-mobile-web-app-status-bar-style' content='black'/> | ||
|
||
<%= htmlWebpackPlugin.options.hookSpaIndexFallback %> |
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.
Shouldn't we provide an example of usage of a hook besides the spafallback script.
e.g. If we give example for analytics, shouldn't we also give example of the hook usage within the a custom index file.
edit: custom index file I mean
<%= htmlWebpackPlugin.options.yourhook %>
Just so there's no confusion around the usage of custom hooks.
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 see what you mean. Will add.
@@ -51,6 +51,17 @@ module.exports = ({ config, context }) => { | |||
} | |||
]; | |||
|
|||
const customHooks = Object.assign({}, ...config.plugins | |||
.filter((plugin) => plugin.type === 'hook') |
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.
Can we give these a more specific name of hook? hooks in general we may have more types of them I'm not sure, maybe we can change that later. When I saw template hooks, I thought it would have to do with page-templates not index.
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.
So maybe there are two things here
hooks
are the API for this particular capability (injecting stuff in index.html, and so otherplugin.type
s would be handled somewhere else because they would be doing a different thing specific to their own implementation. (e.g. in this case, we only care aboutplugin.type === 'hook'
)- The name
hooks
/ Template Hooks may not be the most direct / semantic name, so let think of something else we could try and call it instead.
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.
What about calling the plugin type index instead?
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.
Going to rename them to Index Hooks for now, just to avoid any confusion with App / Page Templates
* first draft * hooks working * plugins docs overview and site navigation * document template hooks * TODO cleanup * clean up console log * update documentation example * API rename and error handling tests
Related Issue
resolves #182
Summary of Changes
Updated TODOs of #188 (please review first)
Misc Thoughts / Questions / Observations