Skip to content

Commit

Permalink
feat(config): .feature() accepts explicit /index.
Browse files Browse the repository at this point in the history
  • Loading branch information
jods4 committed Feb 4, 2017
1 parent 964e398 commit 890f8d5
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/framework-configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,15 @@ export class FrameworkConfiguration {
* @param config The configuration for the specified plugin.
* @return Returns the current FrameworkConfiguration instance.
*/
feature(plugin: string, config?: any): FrameworkConfiguration {
if (getExt(plugin)) {
return this.plugin({ moduleId: plugin, resourcesRelativeTo: [plugin, ''], config: config || {} });
}

return this.plugin({ moduleId: plugin + '/index', resourcesRelativeTo: [plugin, ''], config: config || {} });
feature(plugin: string, config?: any = {}): FrameworkConfiguration {
let hasIndex = /\/index$/i.test(plugin);
let moduleId = hasIndex || getExt(plugin) ?
plugin :
plugin + '/index';
let root = hasIndex ?
plugin.substr(0, plugin.length - 6) :
plugin;
return this.plugin({ moduleId, resourcesRelativeTo: [root, ''], config });
}

/**
Expand Down

0 comments on commit 890f8d5

Please sign in to comment.