DEV: move raw handlebars to /raw-templates/ (#22574)

The primary motivation is to simplify `eagerLoadRawTemplateModules` which curently introspects the module dependencies (the `imports` at runtime). This is no longer supported in Embroider as the AMD shims do not have any dependencies (since it's managed internally with webpack).
This commit is contained in:
Godfrey Chan
2023-07-13 10:57:45 -07:00
committed by GitHub
parent 380890d28b
commit 4d62c49e20
29 changed files with 23 additions and 12 deletions

View File

@ -97,8 +97,14 @@ class ThemeJavascriptCompiler
tree.transform_keys! do |filename|
if filename.ends_with? ".js.es6"
filename.sub(/\.js\.es6\z/, ".js")
elsif filename.ends_with? ".raw.hbs"
filename.sub(/\.raw\.hbs\z/, ".hbr")
elsif filename.include? "/templates/"
filename = filename.sub(/\.raw\.hbs\z/, ".hbr") if filename.ends_with? ".raw.hbs"
if filename.ends_with? ".hbr"
filename.sub(%r{/templates/}, "/raw-templates/")
else
filename
end
else
filename
end
@ -168,7 +174,7 @@ class ThemeJavascriptCompiler
elsif extension == "hbs"
append_ember_template(module_name, content)
elsif extension == "hbr"
append_raw_template(module_name.sub("discourse/templates/", ""), content)
append_raw_template(module_name.sub("discourse/raw-templates/", ""), content)
else
append_js_error(filename, "unknown file extension '#{extension}' (#{filename})")
end