custom css: don't add !important to every line.

Fixes #4398.
This commit is contained in:
evazion
2021-03-13 21:20:20 -06:00
parent 28c0a48117
commit f93b1fe478
2 changed files with 1 additions and 12 deletions

View File

@@ -109,7 +109,7 @@ class UsersController < ApplicationController
end
def custom_style
@css = CustomCss.parse(CurrentUser.user.custom_style)
@css = CurrentUser.user.custom_style
expires_in 10.years
end

View File

@@ -1,11 +0,0 @@
module CustomCss
def self.parse(css)
css.to_s.split(/\r\n|\r|\n/).map do |line|
if line =~ /\A@import/
line
else
line.gsub(/([^[:space:]])[[:space:]]*(?:!important)?[[:space:]]*(;|})/, "\\1 !important\\2")
end
end.join("\n")
end
end