FIX: Precompile all plugin and color definition CSS assets (#11210)
This commit is contained in:
parent
cd6dbd3e9c
commit
5d480257d4
|
@ -150,8 +150,16 @@ class Stylesheet::Manager
|
|||
def self.precompile_css
|
||||
themes = Theme.where('user_selectable OR id = ?', SiteSetting.default_theme_id).pluck(:id, :name, :color_scheme_id)
|
||||
themes << nil
|
||||
|
||||
color_schemes = ColorScheme.where(user_selectable: true).to_a
|
||||
color_schemes << ColorScheme.find_by(id: SiteSetting.default_dark_mode_color_scheme_id)
|
||||
color_schemes = color_schemes.compact.uniq
|
||||
|
||||
targets = [:desktop, :mobile, :desktop_rtl, :mobile_rtl, :desktop_theme, :mobile_theme, :admin]
|
||||
targets += Discourse.find_plugin_css_assets(include_disabled: true, mobile_view: true, desktop_view: true)
|
||||
|
||||
themes.each do |id, name, color_scheme_id|
|
||||
[:desktop, :mobile, :desktop_rtl, :mobile_rtl, :desktop_theme, :mobile_theme, :admin].each do |target|
|
||||
targets.each do |target|
|
||||
theme_id = id || SiteSetting.default_theme_id
|
||||
next if target =~ THEME_REGEX && theme_id == -1
|
||||
cache_key = "#{target}_#{theme_id}"
|
||||
|
@ -162,11 +170,14 @@ class Stylesheet::Manager
|
|||
cache[cache_key] = nil
|
||||
end
|
||||
|
||||
scheme = ColorScheme.find_by_id(color_scheme_id) || ColorScheme.base
|
||||
STDERR.puts "precompile target: #{COLOR_SCHEME_STYLESHEET} #{name} (#{scheme.name})"
|
||||
theme_color_scheme = ColorScheme.find_by_id(color_scheme_id) || ColorScheme.base
|
||||
|
||||
builder = self.new(COLOR_SCHEME_STYLESHEET, id, scheme)
|
||||
builder.compile(force: true)
|
||||
[theme_color_scheme, *color_schemes].uniq.each do |scheme|
|
||||
STDERR.puts "precompile target: #{COLOR_SCHEME_STYLESHEET} #{name} (#{scheme.name})"
|
||||
|
||||
builder = self.new(COLOR_SCHEME_STYLESHEET, id, scheme)
|
||||
builder.compile(force: true)
|
||||
end
|
||||
clear_color_scheme_cache!
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue