DEV: Correct plugin-compilation connector template module path (#19165)
Some plugins store their connectors under `{plugin}/assets/javascripts/templates/connectors`, which is read as `templates/connectors` relative to the base of the JS directory. Our connector checking logic was looking for strings including the leading slash (`/templates`), which not be the case here. Instead we can split on `/` and take the last element. This matches the logic we have for themes in https://github.com/discourse/discourse/blob/1dadf4381f/lib/theme_javascript_compiler.rb#L111 This wasn't actually breaking anything, so this is just a housekeeping commit.
This commit is contained in:
parent
890e4f9854
commit
e330a596f5
|
@ -36,7 +36,7 @@ function unColocateConnectors(tree) {
|
|||
if (
|
||||
match &&
|
||||
match.groups.extension === "hbs" &&
|
||||
!match.groups.prefix.endsWith("/templates")
|
||||
match.groups.prefix.split("/").pop() !== "templates"
|
||||
) {
|
||||
const { prefix, outlet, name } = match.groups;
|
||||
return `${prefix}/templates/connectors/${outlet}/${name}.hbs`;
|
||||
|
@ -44,7 +44,7 @@ function unColocateConnectors(tree) {
|
|||
if (
|
||||
match &&
|
||||
match.groups.extension === "js" &&
|
||||
match.groups.prefix.endsWith("/templates")
|
||||
match.groups.prefix.split("/").pop() === "templates"
|
||||
) {
|
||||
// Some plugins are colocating connector JS under `/templates`
|
||||
const { prefix, outlet, name } = match.groups;
|
||||
|
|
Loading…
Reference in New Issue