fix double add error

This commit is contained in:
chiu 2020-02-26 22:42:59 +08:00
parent 1c7672c77c
commit 3a30ede63c
1 changed files with 2 additions and 2 deletions

View File

@ -37,7 +37,7 @@ all_template.each do |folder|
i = texts.rindex(s1[-1])
texts[i] = ""
end
regex_pattern = /.response-content {\n position: relative;\n}\n|.response-content[^{]*{[^}]*@media[^{]*{[^{]*}[^{]*@media[^{]*{[^{]*}[^}]*}[^}]*}/m
regex_pattern = /.response-content {\n position: static;\n}\n|.response-content {\n position: relative;\n}\n|.response-content[^{]*{[^}]*@media[^{]*{[^{]*}[^{]*@media[^{]*{[^{]*}[^}]*}[^}]*}/m
if !texts.include? "$font-h1:"
texts = "$font-h1: 1.5rem;\n$font-h2: 1.35rem;\n$font-h3: 1.2rem;\n$font-h4: 1.1rem;\n$font-h5: 1rem;\n$font-h6: 0.9rem;\n\n" + texts
end
@ -64,7 +64,7 @@ all_template.each do |folder|
f.write tp_last_text
end
end
if texts.split(regex_pattern).count > 1
if texts.split(regex_pattern).count >= 1
auto_save_text = texts.scan(regex_pattern).join('')
File.open(folder+'assets/stylesheets/template/base/_autobackup.bak', 'a') do |file|
file.puts auto_save_text