-
Notifications
You must be signed in to change notification settings - Fork 30
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 for Astro.extend User/Plugin Space #210
Conversation
I worry that this potentially impacts:
I also am not sure I think the idea of using a global for UI elements in the two defined examples is the cleanest code pattern since it introduces some headache in regards to figuring out the flow of code, debuggability, etc. I wonder if we're better off being prescriptive about enforcing explicit code imports as opposed to utilizing |
My initial thinking around this was actually more like Angular pipes, but possibly using the new Pipe operator syntax - but this would require those functions to be made global - with a namespace, at least there is less chance for abuse. This could be done via a config option where you have to define them explicitly. The idea is to remove the need to import functions over a lot of different components. Sure in the menu example, maybe this should be a component - but maybe you want to have functions that render certain types of content in a more declarative way, session-based helpers, etc FWIW we've built an OpenAPI renderer that just imports a library, parses the file and we pass the object through a bunch of components - it works fine, but with our setup, we can't pass the file object back up to get it at a higher level, so now we have to export the internal parse function and call it every file we use it in - to simplify it we now import the I'm sure there are better ways of architecting what we're building, but it feels like there's a space missing for easy-to-create small functions that don't need to be a whole component |
I'm apprehencive about this in its current form. Personally I'd prefer a singular place where I can go to determine, where plugins, extensions are, it makes it much easier to debug, terse and understand code. |
} | ||
|
||
return ( | ||
<ul class="menu"> |
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.
Is this JSX?
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.
It's psudocode :)
I think some real world use-cases would help this RFC. It's unclear to me what a plugin is or what you'd be using them for. So some examples of plugins you would use/write would make it easier to understand the design. |
Talking to one of the other devs, I think the best example we could find that would be most explainable is to offer a space to have functions like Hugo - https://gohugo.io/functions |
We've revamped our RFC process and this proposal has been returned to a Stage 1 Proposal. For further discussion, please see #536 |
Summary
RFC for
Astro.extend
Userspace, where template plugins can be attached in a style similar to jQuery plugins, here they provide lightweight extensions and templatesLinks