mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 18:02:46 +08:00
FIX: Load .js files from plugins in qunit testing env (#11304)
This commit is contained in:
parent
9fb36290e3
commit
acbc47ef36
|
@ -3,10 +3,10 @@ require_asset("main_include_admin.js")
|
|||
|
||||
DiscoursePluginRegistry.admin_javascripts.each { |js| require_asset(js) }
|
||||
|
||||
DiscoursePluginRegistry.each_globbed_asset(admin: true) do |f, ext|
|
||||
DiscoursePluginRegistry.each_globbed_asset(admin: true) do |f|
|
||||
if File.directory?(f)
|
||||
depend_on(f)
|
||||
elsif f.to_s.end_with?(".#{ext}")
|
||||
else
|
||||
require_asset(f)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<%
|
||||
DiscoursePluginRegistry.javascripts.each { |js| require_asset(js) }
|
||||
DiscoursePluginRegistry.handlebars.each { |hb| require_asset(hb) }
|
||||
DiscoursePluginRegistry.each_globbed_asset do |f, ext|
|
||||
DiscoursePluginRegistry.each_globbed_asset do |f|
|
||||
if File.directory?(f)
|
||||
depend_on(f)
|
||||
elsif f.to_s.end_with?(".#{ext}")
|
||||
else
|
||||
require_asset(f)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -131,8 +131,8 @@ class DiscoursePluginRegistry
|
|||
next if each_options[:admin]
|
||||
end
|
||||
|
||||
Dir.glob("#{root}/**/*") do |f|
|
||||
yield f, ext
|
||||
Dir.glob("#{root}/**/*.#{ext}") do |f|
|
||||
yield f
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -588,11 +588,13 @@ class Plugin::Instance
|
|||
|
||||
# Automatically include all ES6 JS and hbs files
|
||||
root_path = "#{root_dir_name}/assets/javascripts"
|
||||
DiscoursePluginRegistry.register_glob(root_path, 'js') if transpile_js
|
||||
DiscoursePluginRegistry.register_glob(root_path, 'js.es6')
|
||||
DiscoursePluginRegistry.register_glob(root_path, 'hbs')
|
||||
DiscoursePluginRegistry.register_glob(root_path, 'hbr')
|
||||
|
||||
admin_path = "#{root_dir_name}/admin/assets/javascripts"
|
||||
DiscoursePluginRegistry.register_glob(admin_path, 'js', admin: true) if transpile_js
|
||||
DiscoursePluginRegistry.register_glob(admin_path, 'js.es6', admin: true)
|
||||
DiscoursePluginRegistry.register_glob(admin_path, 'hbs', admin: true)
|
||||
DiscoursePluginRegistry.register_glob(admin_path, 'hbr', admin: true)
|
||||
|
|
Loading…
Reference in New Issue
Block a user