Skip to content
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

Config Free Taglib Discovery #329

Closed
mlrawlings opened this issue Jul 13, 2016 · 4 comments
Closed

Config Free Taglib Discovery #329

mlrawlings opened this issue Jul 13, 2016 · 4 comments
Assignees
Labels
good first issue Small tasks that would be good for first time contributors reason-closed:resolved The question was answered, the bug was fixed, or the feature was implemented scope:compiler type:feature A feature request

Comments

@mlrawlings
Copy link
Member

@aniruddh-a and I were discussing how custom tags are discovered, and he wondered why it couldn't just be done automatically. This might be a good idea to explore.

Essentially, it would function kinda like node_modules except based on the components directory (which has become a standard way of doing things). The taglib lookup could search first in the current directory for a components directory and continue walking up to the project root to discover tags.

This actually mirrors the way that marko.json files are discovered and could be done in the same step.

Thoughts?

/cc @marko-js/maintainers

@mlrawlings mlrawlings added type:feature A feature request reason-closed:not a bug This is not a bug, but either user error or intended behavior labels Jul 13, 2016
@patrick-steele-idem
Copy link
Contributor

My initial reaction is that I don't like introducing too much convention since it makes things feel less flexible and introduces more magic. There's also the overhead of now looking for both a marko.json file and a components/ folder. I feel like adding a marko.json file with a single tags-dir property is insignificant and it is extremely flexible. I will let others weigh in though.

@yomed
Copy link
Contributor

yomed commented Jul 13, 2016

It seems like there are a lot of other pieces where we have convention with the additional option of providing your own. E.g. renderer.js will be found automatically, but you can specify your own renderer naming if desired. Might be more consistent to apply that to custom tag discovery as well, so that we look for components/ by default, but allow customization if needed. This would mean that the name components/ can't be used for anything else though.

Practically speaking, my components/ folder is not usually completely flat, so my nested components would need the discovery path in marko.json anyway.

@mlrawlings
Copy link
Member Author

@patrick-steele-idem To reiterate what Yoni said, we already have convention within the tags-dir, this just takes it one step further. I think it makes sense as a default. 🐰 🎩 ✨

@yomed This would allow a structure like:

/
 ⤷ src/
    ⤷ components/
        ⤷ some-component/
           ⤷ components/
               ⤷ some-subcomponent/
           ⤷ renderer.js
           ⤷ template.marko
    ⤷ layouts/
        ⤷ main/
           ⤷ components/
               ⤷ some-layout-specific-component/
           ⤷ layout.marko
    ⤷ pages/
        ⤷ home/
           ⤷ components/
               ⤷ some-page-specific-component/
           ⤷ index.js
           ⤷ template.marko

without a marko.json at each level.

@mlrawlings mlrawlings added status:todo and removed reason-closed:not a bug This is not a bug, but either user error or intended behavior labels Jul 15, 2016
@mlrawlings mlrawlings self-assigned this Jul 15, 2016
@mlrawlings mlrawlings added scope:compiler good first issue Small tasks that would be good for first time contributors labels Jul 15, 2016
@yomed
Copy link
Contributor

yomed commented Jul 15, 2016

@mlrawlings I see, although in my case I don't normally need an entire new components folder for my sub components, so it would be like

/
 ⤷ src/
    ⤷ components/
        ⤷ some-component/
               ⤷ some-subcomponent/
               ⤷ another-subcomponent/
           ⤷ index.js
           ⤷ template.marko

So if this change was made it would mean that my small projects wouldn't need a marko.json file, while my larger projects would have one string removed from the config lookup array.

@mlrawlings mlrawlings added the reason-closed:resolved The question was answered, the bug was fixed, or the feature was implemented label Jul 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Small tasks that would be good for first time contributors reason-closed:resolved The question was answered, the bug was fixed, or the feature was implemented scope:compiler type:feature A feature request
Projects
None yet
Development

No branches or pull requests

3 participants