Skip to content

Commit

Permalink
Merge pull request aurelia#710 from jods4/feature
Browse files Browse the repository at this point in the history
feat(config): .feature() accepts explicit /index.
  • Loading branch information
EisenbergEffect authored Feb 5, 2017
2 parents d650b01 + 890f8d5 commit ee31a6c
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 ee31a6c

Please sign in to comment.