0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-25 18:50:27 +01:00
discourse-custom-wizard/assets/javascripts/wizard-raw-templates.js.erb
2019-01-29 11:30:35 +11:00

22 Zeilen
654 B
Text

<%=
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
%>