Refactor scss live refreshing

This commit is contained in:
Penar Musaraj
2021-06-27 06:23:50 -04:00
committed by Alan Guo Xiang Tan
parent 99d259d39b
commit a838293aaf
3 changed files with 28 additions and 65 deletions

View File

@ -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