-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Initializers are required automatically #242
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* global requirejs, require */ | ||
|
||
export default function bootApp(prefix, attributes) { | ||
var App = require(prefix + '/app')['default']; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think there should be a discussion if the app directory in ember-cli is strictly for business concerns or not. If it is (similar to Rails) then initializers should not be in the app directory. They would be a configuration concern. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. as-is the app/ directory now has 10 directories in it. Things are getting crowded there. (I don't know why stylesheets are in the app directory but I guess that is another conversation) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're raising valid concerns. We got it in to make developer's life somewhat easier and just to take it for a spin to see how it feels. There's a lot of things to discuss around configuration (what suppose to be where, what to expose, etc.). It will be one of the things on the roadmap. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. something else to add to the constraints of folder layout, is to have other folders of lazy loadable bundles There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently the thinking is:
I personally like the inititializers being in the If we want to spilt propose a spilt of js and non js stuff. (That's currently just |
||
var initializersRegExp = new RegExp(prefix + '/initializers'); | ||
|
||
Ember.keys(requirejs._eak_seen).filter(function(key) { | ||
return initializersRegExp.test(key); | ||
}).forEach(function(moduleName) { | ||
var module = require(moduleName, null, null, true); | ||
if (!module) { throw new Error(moduleName + ' must export an initializer.'); } | ||
App.initializer(module['default']); | ||
}); | ||
|
||
return App.create(attributes || {}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for not hardcoding the modulePrefix there!