Skip to content

modelUtils - hardcoded typePath #493

Open
@crwang

Description

@crwang

Hi guys,

I'm trying to restructure our app in a way that would be more conducive to require js bundling.

What I'd like to do is have this structure:

├─┬ app
│ ├── collections
│ ├── controllers
│ ├── lib
│ ├── models
│ ├── templates
│ ├── views
│ │
│ ├─┬ bundle1
│ │ ├── collections
│ │ ├── controllers
│ │ ├── lib
│ │ ├── models
│ │ ├── templates
│ │ └── views
│ │ 
│ └─┬ bundle2
│   ├── collections
│   ├── controllers
│   ├── lib
│   ├── models
│   ├── templates
│   └── views

I personally feel this structure will make the requirejs bundling much cleaner and it could help with making things more componentized so that people could more easily share code.

However, modelUtils is currently hardcoding typePath with the app on the front as:

var typePath = {
  model: "app/models/",
  collection: "app/collections/"
};

https://github.com/rendrjs/rendr/blob/master/shared/modelUtils.js

It doesn't seem like there's a really simple way to workaround this without breaking changes.

One idea is to allow passing in a forward slash so a model could have the name:

/bundle1/model_name and then getFullPath in modelUtils could look for that and not prepend app, but that's pretty ugly and a patch.

Any thoughts on this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions