discourse/app/assets/javascripts/discourse-plugins/colocated-template-compiler.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
537 B
JavaScript
Raw Normal View History

const ColocatedTemplateProcessor = require("ember-cli-htmlbars/lib/colocated-broccoli-plugin");
module.exports = class DiscoursePluginColocatedTemplateProcessor extends (
ColocatedTemplateProcessor
) {
detectRootName() {
const entries = this.currentEntries().filter((e) => !e.isDirectory());
const path = entries[0]?.relativePath;
const match = path?.match(
/^discourse\/plugins\/(?<name>[^/]+)\/discourse\//
);
if (match) {
return `discourse/plugins/${match.groups.name}/discourse`;
}
}
};