You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

42 lines
1.3 KiB

FILES = [
"app/assets/stylesheets/admin.css",
"app/assets/stylesheets/application.css",
"app/assets/stylesheets/assets.css",
"app/assets/stylesheets/attachments.css",
"app/assets/stylesheets/form.css",
"app/assets/stylesheets/forms.css",
"app/assets/stylesheets/lists.css",
"app/assets/stylesheets/nodes.css",
"app/assets/stylesheets/popup-menu.css",
"app/assets/stylesheets/sessions.css",
"app/assets/stylesheets/tom-select.css"
]
FILES.each do |file_path|
full_path = File.join(Dir.pwd, file_path)
next unless File.exist?(full_path)
content = File.read(full_path)
# 1. Recalculate rem values
# Improved regex to handle .75rem as well as 0.75rem and 1rem
content.gsub!(/(\d*\.\d+|\d+)rem/) do |match|
numeric_part = $1
val = numeric_part.to_f
new_val = (val * 0.625).to_r.to_f
formatted_val = new_val.to_s.gsub(/\.0$/, "")
# If the original was .75rem, we might want to keep the dot-only style,
# but 0.46875rem is more standard and safer.
"#{formatted_val}rem"
end
# 2. Update font-size/font from 10px to 16px
# Only inside font or font-size declarations
content.gsub!(/(font(?:-size)?\s*:\s*[^;]+;)/i) do |decl|
decl.gsub(/\b10px\b/, "16px")
end
File.write(full_path, content)
puts "Updated #{file_path}"
end