This allows for a pod structure of:
- app
- components
- vimeo-video
- vimeo-video-component.js
- vimeo-video-template.hbs
- vimeo-video
- components
This allows for a pod structure of:
import Resolver from './resolver'; |
// Allow pod templates that aren't named template.hbs | |
app._podTemplatePatterns = function() { | |
return this.registry.extensionsForType('template').map(function(extension) { | |
return new RegExp('\.(.+\.)?' + extension + '$'); | |
}); | |
}; |
import Ember from 'ember'; | |
import Resolver from 'ember/resolver'; | |
export default Resolver.extend({ | |
podBasedLookupWithPrefixWithName: function(podPrefix, parsedName) { | |
var fullNameWithoutType = parsedName.fullNameWithoutType; | |
if (parsedName.type === 'template') { | |
fullNameWithoutType = fullNameWithoutType.replace(/^components\//, ''); | |
} | |
return podPrefix + '/' + fullNameWithoutType + '/' + fullNameWithoutType + '-' + parsedName.type; | |
}, | |
podBasedComponentsInSubdirWithName: function(parsedName) { | |
var podPrefix = this.namespace.podModulePrefix || this.namespace.modulePrefix; | |
podPrefix = podPrefix + '/components'; | |
if (parsedName.type === 'component' || parsedName.fullNameWithoutType.match(/^components/)) { | |
return this.podBasedLookupWithPrefixWithName(podPrefix, parsedName); | |
} | |
}, | |
moduleNameLookupPatterns: Ember.computed(function(){ | |
var patterns = this._super(); | |
patterns.unshiftObject(this.podBasedComponentsInSubdirWithName); | |
return patterns; | |
}) | |
}); |