You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm about to implement some templates into my Flutter app, but I ran into one little snag.
It would be super nice if you could specify multiple template files to build when writing your mason.yaml. For example, running mason build widget could generate view code and a test file.
We also may want to move where the vars property lives. I believe they are still bound to each template? If they were bound to a build command it would be easy to share them with multiple template files. Since mason.yaml is now required I don't think that's much of a stretch anyway.
If we're doing that, does it make sense to move all that metadata into a build command? I know we don't want to over-engineer the tool, but maybe it makes sense to keep the mason.yaml option available, but still pass in simple template.yaml files as well?
Example
mason.yaml
builds:
greetings:
description: A simple greeting in markdown.templates:
- path: ./greetings.mdvars:
- namewidget:
description: A Flutter widget containing a view, bloc, and test scafold for the bloc.templates:
- git:
url: git@github.com:felangel/mason.gitpath: templates/widget/view_template.dart.txt
- git:
url: git@github.com:felangel/mason.gitpath: templates/widget/test_template.dart.txtvars:
- name
- generateBloc
YMK what you think. I'm happy to jump on a call to discuss, and happy to contribute the feature in a PR if you think it's a good direction to take things 🙂
The text was updated successfully, but these errors were encountered:
In this case, I would recommend having the view_template.dart and test_template.dart be part of the same widget template. The url of the template in this case would just point to the template.yaml which registers the vars and the __template__ itself can contain multiple files and subdirectories (for the view and test files).
Let me know if that helps and I'm happy to jump on a call as well to discuss further 👍
@felangel Gotcha thanks. We may want to adjust the readme or examples to have that flow so people know it's possible, but that's great it is possible! 💯 🎉
Motivation
I'm about to implement some templates into my Flutter app, but I ran into one little snag.
It would be super nice if you could specify multiple template files to build when writing your
mason.yaml
. For example, runningmason build widget
could generate view code and a test file.We also may want to move where the
vars
property lives. I believe they are still bound to each template? If they were bound to a build command it would be easy to share them with multiple template files. Sincemason.yaml
is now required I don't think that's much of a stretch anyway.If we're doing that, does it make sense to move all that metadata into a build command? I know we don't want to over-engineer the tool, but maybe it makes sense to keep the
mason.yaml
option available, but still pass in simpletemplate.yaml
files as well?Example
mason.yaml
YMK what you think. I'm happy to jump on a call to discuss, and happy to contribute the feature in a PR if you think it's a good direction to take things 🙂
The text was updated successfully, but these errors were encountered: