-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Proposal: Reusable template blocks #2858
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
Comments
Something like this would be very useful. I wonder if it can be done without introducing new
It could simply work like an imported |
I can't find the issue right now, but something like this for defining inline mini-components was considered and rejected in the past. This does seem more doable if it's more or less treated as a macro with no special scoping, but at that point this could also be implemented with preprocessors. |
There is also this useful proposal: #2940 |
In case anyone is interested here's a preprocessor to implement this.
Example
I used comments so tools such as prettier still work. |
I often find my self writing code like the following.
For the the purposes of DRY I would normally extract the repeating span to another component but do so can complicate styling and state access. In addition only one component would use the new component.
I propose a way of writing reusable inline blocks. Something like this.
The text was updated successfully, but these errors were encountered: