Fix bootstrap js include twice bug.

This commit is contained in:
BoHung Chiu 2021-12-16 11:21:40 +08:00
parent 6b2930860e
commit e636be4b4c
1 changed files with 5 additions and 0 deletions

View File

@ -50,6 +50,11 @@ all_template.each do |folder|
filename = folder+'partial/_head.html.erb'
texts = File.read(filename).force_encoding('UTF-8')
new_texts = texts.gsub(/<.*javascript_include_tag.*bootstrap.*>/,"<%= javascript_include_tag \"bootstrap.min\"%>")
bootstrap_count = 0
new_texts.gsub("<%= javascript_include_tag \"bootstrap.min\"%>"){|t|
bootstrap_count += 1
(bootstrap_count > 1) ? "" : t
}
if new_texts.include?('jquery_prefix')
new_texts = new_texts.gsub(/<.*javascript_include_tag.*\/jquery\.min.*>|<.*javascript_include_tag.*\/jquery-1\.11\.0\.min.*>/,"<%= javascript_include_tag \"jquery.min\"%>")
else