Support for defining components within plugins
This commit is contained in:
parent
09dc3f128f
commit
aa9e89b6c8
|
@ -47,10 +47,14 @@ Discourse.Resolver = Ember.DefaultResolver.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
customResolve: function(parsedName) {
|
customResolve: function(parsedName) {
|
||||||
var moduleName = 'discourse/' + parsedName.type + 's/' + parsedName.fullNameWithoutType,
|
// If we end with the name we want, use it. This allows us to define components within plugins.
|
||||||
module = requirejs.entries[moduleName];
|
var suffix = parsedName.type + 's/' + parsedName.fullNameWithoutType,
|
||||||
|
moduleName = Ember.keys(requirejs.entries).find(function(e) {
|
||||||
|
return e.indexOf(suffix, e.length - suffix.length) !== -1;
|
||||||
|
});
|
||||||
|
|
||||||
if (module) {
|
var module;
|
||||||
|
if (moduleName) {
|
||||||
module = require(moduleName, null, null, true /* force sync */);
|
module = require(moduleName, null, null, true /* force sync */);
|
||||||
if (module && module['default']) { module = module['default']; }
|
if (module && module['default']) { module = module['default']; }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue