1
0
Fork 0
discourse-custom-wizard-unl.../assets/javascripts/wizard-raw-templates.js.erb

38 Zeilen
989 B
Text

// discourse-skip-module
<%=
result = ''
Discourse.unofficial_plugins.each do |plugin|
plugin_name = plugin.metadata.name
if plugin_name == 'discourse-custom-wizard' || CustomWizard::Field.require_assets[plugin_name]
files = []
plugin.each_globbed_asset do |f, is_dir|
files.push(f) if f.include? "hbr"
end
Dir.glob("#{Rails.root}/app/assets/javascripts/discourse/app/templates/*.hbr").each do |f|
files.push(f)
end
files.each do |f|
name = File.basename(f, ".hbr")
compiled = Barber::Precompiler.new().compile(File.read(f))
result << "
(function() {
requirejs('discourse/plugins/discourse-custom-wizard/legacy/raw-templates').addRawTemplate(#{compiled});
})();
"
end
result << "
(function() {
window.__DISCOURSE_RAW_TEMPLATES = requirejs('discourse/plugins/discourse-custom-wizard/legacy/raw-templates').__DISCOURSE_RAW_TEMPLATES;
})();
"
end
end
result
%>