fix problem

This commit is contained in:
chiu 2020-02-26 19:46:51 +08:00
parent 572663f55c
commit 1e92ace50c
1 changed files with 7 additions and 2 deletions

View File

@ -9,7 +9,7 @@ all_template = Dir.glob(template_path+'/*/')
puts 'editing files for sassc'
new_gemfile_text = File.read(app_path+'/temp_file/Gemfile')
old_gemfile_text = File.read(env_pwd+'/Gemfile')
check_texts = ['@import "../../bootstrap/variables";',".response-content {\n position: relative;\n}\n"]
check_texts = ['@import "../../bootstrap/variables";',".response-content {\n position: static;\n}\n"]
git_url = Bundler.with_clean_env{%x[cd '#{env_pwd}' && git config --get remote.origin.url].sub("\n",'')}
git_remote = Bundler.with_clean_env{%x[cd '#{env_pwd}' && git remote].sub("\n",'')}
if git_url != 'https://ruling.digital/git'
@ -32,7 +32,12 @@ all_template.each do |folder|
texts = File.open(filename,'r:UTF-8') do |f|
f.read
end
regex_pattern = /.response-content[^{]*{[^}]*@media[^{]*{[^{]*}[^{]*@media[^{]*{[^{]*}[^}]*}[^}]*}/m
s1 = texts.scan(/{|}/)
if s1.count % 2 != 0
i = texts.rindex(s1[-1])
texts[i] = ''
end
regex_pattern = /.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