mirror of
https://github.com/discourse/discourse.git
synced 2025-06-01 17:40:43 +08:00
Refactor scss live refreshing
This commit is contained in:

committed by
Alan Guo Xiang Tan

parent
99d259d39b
commit
a838293aaf
@ -96,11 +96,7 @@ module Stylesheet
|
||||
targets = target ? [target] : ["desktop", "mobile", "admin"]
|
||||
Stylesheet::Manager.clear_core_cache!(targets)
|
||||
message = targets.map! do |name|
|
||||
msgs = []
|
||||
active_themes.each do |theme_id|
|
||||
msgs << Stylesheet::Manager.new(theme_id: theme_id).stylesheet_data(name.to_sym)
|
||||
end
|
||||
msgs
|
||||
Stylesheet::Manager.new.stylesheet_data(name.to_sym)
|
||||
end.flatten!
|
||||
MessageBus.publish '/file-change', message
|
||||
end
|
||||
@ -114,11 +110,7 @@ module Stylesheet
|
||||
targets.push(plugin_name)
|
||||
end
|
||||
message = targets.map! do |name|
|
||||
msgs = []
|
||||
active_themes.each do |theme_id|
|
||||
msgs << Stylesheet::Manager.new(theme_id: theme_id).stylesheet_data(name.to_sym)
|
||||
end
|
||||
msgs
|
||||
Stylesheet::Manager.new.stylesheet_data(name.to_sym)
|
||||
end.flatten!
|
||||
MessageBus.publish '/file-change', message
|
||||
end
|
||||
@ -143,9 +135,5 @@ module Stylesheet
|
||||
end
|
||||
end
|
||||
|
||||
def active_themes
|
||||
@active_themes ||= Theme.user_selectable.pluck(:id)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user