icholy / ember-brunch

80 stars 23 forks source link

Structure improvement ideas #15

Closed vojto closed 11 years ago

vojto commented 11 years ago

Hi,

I think the current structure is overly complicated. I mean the fact that there are files like views.js, models.js, etc. with sole purpose of requiring more files.

I understand this can be useful in case of big applications, but it's very annoying for quick simple apps. I think we should make this simple to use for everyone, the advanced users will change the structure anyways.

I thought about simplifying it and I came up with this for initialize.js. It would simply require everything.

window.App = require('app');

require('templates/application');
require('templates/home');
require('templates/bob');

require('models/bob');

require('controllers/application');
require('controllers/home');
require('controllers/bob');

require('views/application');
require('views/home');
require('views/bob');

require('store');

require('router');

Secondly, I removed routes.js and whole routes directory. The routes can be all in router.js.

Please let me know what do you think about this idea, and I can submit a pull request.

icholy commented 11 years ago

routes directory is staying, I like it.

I've been thinking about using index.js files (discussion #6) .

seankeating commented 11 years ago

If we simplified the app, we don't currently need the controllers at all since Ember will create them for us, because there isn't anything special in them. But I liked the idea of having an example in place, but this could also lead to unnecessary files...

Additionally, if we can find a way to compile the templates without the 'template' in the beginning of the defined name, we could remove the view files. Again Ember will make these for us, in the new structure, if we have them in the expected folder/file name structure.

icholy commented 11 years ago

tbh I haven't really played too much with the latest versions of ember. I'll be starting a new ember project in the near future and I don't want to change the structure too much until I know what works.

icholy commented 11 years ago

@vojto all the requires are in initialize.js now