mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Migrate pretty-text to .js
extensions (#9243)
This commit is contained in:
parent
8174f1551c
commit
c150566506
@ -37,7 +37,8 @@ class DiscourseJsProcessor
|
|||||||
|
|
||||||
relative_path = filename.sub(Rails.root.to_s, '').sub(/^\/*/, '')
|
relative_path = filename.sub(Rails.root.to_s, '').sub(/^\/*/, '')
|
||||||
relative_path.start_with?("app/assets/javascripts/discourse/") ||
|
relative_path.start_with?("app/assets/javascripts/discourse/") ||
|
||||||
relative_path.start_with?("app/assets/javascripts/admin/")
|
relative_path.start_with?("app/assets/javascripts/admin/") ||
|
||||||
|
relative_path.start_with?("app/assets/javascripts/pretty-text/")
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.skip_module?(data)
|
def self.skip_module?(data)
|
||||||
|
@ -23,6 +23,9 @@ module PrettyText
|
|||||||
|
|
||||||
erb_name = "#{filename}.js.es6.erb"
|
erb_name = "#{filename}.js.es6.erb"
|
||||||
return erb_name if File.file?("#{root}#{erb_name}")
|
return erb_name if File.file?("#{root}#{erb_name}")
|
||||||
|
|
||||||
|
erb_name = "#{filename}.js.erb"
|
||||||
|
return erb_name if File.file?("#{root}#{erb_name}")
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.apply_es6_file(ctx, root_path, part_name)
|
def self.apply_es6_file(ctx, root_path, part_name)
|
||||||
@ -55,7 +58,7 @@ module PrettyText
|
|||||||
elsif l =~ /\/\/= require_tree (\.\/)?(.*)$/
|
elsif l =~ /\/\/= require_tree (\.\/)?(.*)$/
|
||||||
path = Regexp.last_match[2]
|
path = Regexp.last_match[2]
|
||||||
Dir["#{root_path}/#{path}/**"].sort.each do |f|
|
Dir["#{root_path}/#{path}/**"].sort.each do |f|
|
||||||
apply_es6_file(ctx, root_path, f.sub(root_path, '')[1..-1].sub(/\.js.es6$/, ''))
|
apply_es6_file(ctx, root_path, f.sub(root_path, '')[1..-1].sub(/\.js(.es6)?$/, ''))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -94,7 +97,7 @@ module PrettyText
|
|||||||
to_load.uniq.each do |f|
|
to_load.uniq.each do |f|
|
||||||
if f =~ /^.+assets\/javascripts\//
|
if f =~ /^.+assets\/javascripts\//
|
||||||
root = Regexp.last_match[0]
|
root = Regexp.last_match[0]
|
||||||
apply_es6_file(ctx, root, f.sub(root, '').sub(/\.js\.es6$/, ''))
|
apply_es6_file(ctx, root, f.sub(root, '').sub(/\.js(\.es6)?$/, ''))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user