add wizard raw template pre-compilation
Dieser Commit ist enthalten in:
Ursprung
8eee281e25
Commit
2e861f6b69
4 geänderte Dateien mit 26 neuen und 0 gelöschten Zeilen
|
@ -21,4 +21,5 @@
|
|||
window.Discourse = {}
|
||||
window.Wizard = {};
|
||||
Wizard.SiteSettings = {};
|
||||
Wizard.RAW_TEMPLATES = {};
|
||||
Discourse.__widget_helpers = {};
|
||||
|
|
|
@ -4,6 +4,8 @@ Discourse.unofficial_plugins.each do |plugin|
|
|||
plugin_name = plugin.metadata.name
|
||||
if require_plugin_assets = CustomWizard::Field.require_assets[plugin_name]
|
||||
plugin.each_globbed_asset do |f, is_dir|
|
||||
next if f.include? "raw.hbs"
|
||||
|
||||
if require_plugin_assets.any? { |dir| f.include?(dir) }
|
||||
if is_dir
|
||||
depend_on(f)
|
||||
|
|
22
assets/javascripts/wizard-raw-templates.js.erb
Normale Datei
22
assets/javascripts/wizard-raw-templates.js.erb
Normale Datei
|
@ -0,0 +1,22 @@
|
|||
<%=
|
||||
result = ''
|
||||
Discourse.unofficial_plugins.each do |plugin|
|
||||
plugin_name = plugin.metadata.name
|
||||
if require_plugin_assets = CustomWizard::Field.require_assets[plugin_name]
|
||||
plugin.each_globbed_asset do |f, is_dir|
|
||||
if f.include? "raw.hbs"
|
||||
name = File.basename(f, ".raw.hbs")
|
||||
compiled = Barber::Precompiler.new().compile(File.read(f))
|
||||
result << "
|
||||
(function() {
|
||||
if ('Wizard' in window) {
|
||||
Wizard.RAW_TEMPLATES['javascripts/#{name}'] = requirejs('discourse-common/lib/raw-handlebars').template(#{compiled});
|
||||
}
|
||||
})();
|
||||
"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
result
|
||||
%>
|
|
@ -40,5 +40,6 @@
|
|||
<%- end %>
|
||||
|
||||
<%= preload_script 'wizard-custom-start' %>
|
||||
<%= preload_script 'wizard-raw-templates' %>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Laden …
In neuem Issue referenzieren