mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 11:23:25 +08:00
FIX: Allow plugins to provide test directories with transpiled .js
This commit is contained in:
parent
c52191d49e
commit
7f8c5cf70b
|
@ -548,6 +548,9 @@ class Plugin::Instance
|
|||
if transpile_js
|
||||
DiscourseJsProcessor.plugin_transpile_paths << root_path.sub(Rails.root.to_s, '').sub(/^\/*/, '')
|
||||
DiscourseJsProcessor.plugin_transpile_paths << admin_path.sub(Rails.root.to_s, '').sub(/^\/*/, '')
|
||||
|
||||
test_path = "#{root_dir_name}/test/javascripts"
|
||||
DiscourseJsProcessor.plugin_transpile_paths << test_path.sub(Rails.root.to_s, '').sub(/^\/*/, '')
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -12,8 +12,9 @@
|
|||
Discourse.plugins.each do |p|
|
||||
root_path = "#{File.dirname(p.path)}/test/javascripts"
|
||||
|
||||
Dir.glob(root_path + '/**/**.es6').each do |f|
|
||||
require_asset(f)
|
||||
end
|
||||
to_glob = [root_path + '/**/**.es6']
|
||||
to_glob << (root_path + '/**/**.js') if p.transpile_js
|
||||
|
||||
Dir.glob(to_glob) { |f| require_asset(f) }
|
||||
end
|
||||
%>
|
||||
|
|
Loading…
Reference in New Issue
Block a user