From e636be4b4c9dcf44a0d16326d0fb2b6bb595f7ff Mon Sep 17 00:00:00 2001 From: Bohung Date: Thu, 16 Dec 2021 11:21:40 +0800 Subject: [PATCH] Fix bootstrap js include twice bug. --- patchfile.gemspec | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/patchfile.gemspec b/patchfile.gemspec index 185fe0d..a8e6545 100644 --- a/patchfile.gemspec +++ b/patchfile.gemspec @@ -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