mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 22:21:55 +08:00
FIX: Live reload plugin stylesheets when the color scheme changes
This commit is contained in:
parent
081c36a459
commit
3da9b99dbf
|
@ -264,6 +264,7 @@ class Theme < ActiveRecord::Base
|
||||||
|
|
||||||
if with_scheme
|
if with_scheme
|
||||||
targets.prepend(:desktop, :mobile, :admin)
|
targets.prepend(:desktop, :mobile, :admin)
|
||||||
|
targets.append(*Discourse.find_plugin_css_assets(mobile_view: true, desktop_view: true))
|
||||||
Stylesheet::Manager.cache.clear if clear_manager_cache
|
Stylesheet::Manager.cache.clear if clear_manager_cache
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,6 @@
|
||||||
<%= discourse_stylesheet_link_tag(mobile_view? ? :mobile_theme : :desktop_theme) %>
|
<%= discourse_stylesheet_link_tag(mobile_view? ? :mobile_theme : :desktop_theme) %>
|
||||||
<%- end %>
|
<%- end %>
|
||||||
|
|
||||||
<%- Discourse.find_plugin_css_assets(include_official: allow_plugins?, include_unofficial: allow_third_party_plugins?, mobile_view: mobile_view?).each do |file| %>
|
<%- Discourse.find_plugin_css_assets(include_official: allow_plugins?, include_unofficial: allow_third_party_plugins?, mobile_view: mobile_view?, desktop_view: !mobile_view?).each do |file| %>
|
||||||
<%= discourse_stylesheet_link_tag(file) %>
|
<%= discourse_stylesheet_link_tag(file) %>
|
||||||
<%- end %>
|
<%- end %>
|
||||||
|
|
|
@ -217,14 +217,19 @@ module Discourse
|
||||||
def self.find_plugin_css_assets(args)
|
def self.find_plugin_css_assets(args)
|
||||||
plugins = self.find_plugins(args)
|
plugins = self.find_plugins(args)
|
||||||
|
|
||||||
assets = plugins.find_all do |plugin|
|
assets = []
|
||||||
plugin.css_asset_exists?
|
|
||||||
end.map { |plugin| plugin.directory_name }
|
|
||||||
|
|
||||||
target = args[:mobile_view] ? :mobile : :desktop
|
targets = [nil]
|
||||||
assets += plugins.find_all do |plugin|
|
targets << :mobile if args[:mobile_view]
|
||||||
plugin.css_asset_exists?(target)
|
targets << :desktop if args[:desktop_view]
|
||||||
end.map { |plugin| "#{plugin.directory_name}_#{target}" }
|
|
||||||
|
targets.each do |target|
|
||||||
|
assets += plugins.find_all do |plugin|
|
||||||
|
plugin.css_asset_exists?(target)
|
||||||
|
end.map do |plugin|
|
||||||
|
target.nil? ? plugin.directory_name : "#{plugin.directory_name}_#{target}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
assets
|
assets
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user