From 1e92ace50c36fc7c372aeeb0550689e963b86cd5 Mon Sep 17 00:00:00 2001 From: chiu Date: Wed, 26 Feb 2020 19:46:51 +0800 Subject: [PATCH] fix problem --- announcement.gemspec | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/announcement.gemspec b/announcement.gemspec index c3bfecc..345c609 100644 --- a/announcement.gemspec +++ b/announcement.gemspec @@ -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