mirror of
https://github.com/discourse/discourse.git
synced 2025-04-19 15:49:05 +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
|
if transpile_js
|
||||||
DiscourseJsProcessor.plugin_transpile_paths << root_path.sub(Rails.root.to_s, '').sub(/^\/*/, '')
|
DiscourseJsProcessor.plugin_transpile_paths << root_path.sub(Rails.root.to_s, '').sub(/^\/*/, '')
|
||||||
DiscourseJsProcessor.plugin_transpile_paths << admin_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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -12,8 +12,9 @@
|
|||||||
Discourse.plugins.each do |p|
|
Discourse.plugins.each do |p|
|
||||||
root_path = "#{File.dirname(p.path)}/test/javascripts"
|
root_path = "#{File.dirname(p.path)}/test/javascripts"
|
||||||
|
|
||||||
Dir.glob(root_path + '/**/**.es6').each do |f|
|
to_glob = [root_path + '/**/**.es6']
|
||||||
require_asset(f)
|
to_glob << (root_path + '/**/**.js') if p.transpile_js
|
||||||
end
|
|
||||||
|
Dir.glob(to_glob) { |f| require_asset(f) }
|
||||||
end
|
end
|
||||||
%>
|
%>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user