1
0
Fork 0
discourse-custom-wizard-unl.../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
%>