-
Notifications
You must be signed in to change notification settings - Fork 265
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
Suggestions/discussion for features enabling better structured apps #480
Comments
@cjblomqvist looks interesting.
So it's basically the analogue of npm packages funcionality but without taking versioning into consideration. If we also want to have an ability for components to depend on different versions of the same component then the complexity drastically increases. Without versioning we can have the structure similar to how browserify allows the "browser" field to be specified in package.json -- our system can have a section named i.e. "components" that can be either array (if we don't care about private name) or an object that maps components we specified in "dependencies" section by the private names they are going to be used in viwes of this component: "name": "my-cool-component"
"components": {
"bootstrap": "d-bootstrap"
},
"dependencies": {
"d-bootstrap": "*"
} and in the view of <view is='bootstrap:tabs' /> if the "components" section is an array then it uses the default name of the dep components as specified in those components themselves. Also considering that we have a guideline that everyone follows to name derby components starting with |
Thanks for your contributing your issue. We have recently been actively updating the Derby and Racer packages, and both repos are now in Typescript and published with types on npm. As we have quite a few old issues open we have made the decision to close out of date issues. If this issue still matters to you we encourage reproducing against the current versions of the repo and opening a new issue. |
There's a need to be able to better structure ones apps. Basically, my take on this is that you'd want to keep the following together with each component:
Basically, it makes sense if it's possible to specify this on each component. Take below example of a structure:
/mycomponent/index.js - my "Controller" class
/mycomponent/views/index.html - the view for mycomponent
/mycomponent/styles/index.css - the css for mycomponent
/mycomponent/components/subcomponent1/index.js - A direct subcomponent to mycomponent, only used for better structuring mycomponent (i.e. not a generic subcomponent)
/mycomponent/components/subcomponent1/... - Follows the same structure as above
To facilitate this scenario, without mycomponent being dependent on any other structure and knowing where the app is (i.e. the variable holding the created derby app), there are some missing features currently:
Preferably, if Derby wants to be opiniated, this could of course be automatically done (possibly overriden by the mycomponent constructor prototype). My suggestion would also be to automatically namespace in some way. We've already discussed some alternatives and issues for CSS (and e.g. stylus) here: #477 I also made a simple plugin ( https://github.com/BBWeb/d-subcomponents ) which replaces the app.component fn which facilitates specifying subcomponents for anyone running into similar issues meanwhile something proper is thought of for Derby.
Further, it is a little bit tedious to add functionality to the app.component fn, if there are any way it can be refactored so that it is easier to modify, this might be something that'd be nice!
Anyway, I wanted to bring up some thoughts on the matter. So far this is far from a full discussion on how Derby should support devs to structure their apps, but at least it's a start. Would love to hear your thoughts either here on GitHub or in the next open source office hours (I'll try to make it, otherwise feel free to comment anyway).
The text was updated successfully, but these errors were encountered: