DEV: Remove Discourse.RAW_TEMPLATES (#9630)

We were sharing `Discourse` both as an application object and a
namespace which complicated things for Ember CLI. This patch
moves raw templates into `__DISCOURSE_RAW_TEMPLATES` and adds
a couple helper methods to create/remove them.
This commit is contained in:
Robin Ward
2020-05-05 12:15:03 -04:00
committed by GitHub
parent 657facb1d5
commit 612284cef3
20 changed files with 75 additions and 53 deletions

View File

@ -195,9 +195,9 @@ class ThemeJavascriptCompiler
compiled = RawTemplatePrecompiler.new(@theme_id).compile(hbs_template)
@content << <<~JS
(function() {
if ('Discourse' in window) {
Discourse.RAW_TEMPLATES[#{raw_template_name(name)}] = requirejs('discourse-common/lib/raw-handlebars').template(#{compiled});
}
const addRawTemplate = requirejs('discourse-common/lib/raw-templates').addRawTemplate;
const template = requirejs('discourse-common/lib/raw-handlebars').template(#{compiled});
addRawTemplate(#{raw_template_name(name)}, template);
})();
JS
rescue Barber::PrecompilerError => e