discourse/app/assets/javascripts/discourse-plugins/colocated-template-compiler.js
David Taylor 0a33c507d9
DEV: Improve colocated component rootName logic (#18708)
The complex regex-based detection was based on Ember CLI's implementation, which is necessarily generic and needs to auto-detect the name. In our case, we know the name of the plugin so we can just pass it in - no need for dynamic detection. This resolves issues when there are other files in the `discourse/plugins/{name}` directory which are sorted before `discourse/`
2022-10-21 20:20:46 +01:00

15 lines
420 B
JavaScript

const ColocatedTemplateProcessor = require("ember-cli-htmlbars/lib/colocated-broccoli-plugin");
module.exports = class DiscoursePluginColocatedTemplateProcessor extends (
ColocatedTemplateProcessor
) {
constructor(tree, discoursePluginName) {
super(tree);
this.discoursePluginName = discoursePluginName;
}
detectRootName() {
return `discourse/plugins/${this.discoursePluginName}/discourse`;
}
};