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

Comments

Projects
None yet
3 participants
@mlrawlings
Copy link
Member

commented Jul 13, 2016

@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

@patrick-steele-idem

This comment has been minimized.

Copy link
Contributor

commented Jul 13, 2016

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

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

Copy link
Member Author

commented Jul 13, 2016

@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.

@yomed

This comment has been minimized.

Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.