DEV: watch for changes to plugin mobile/desktop SCSS

Previously, the watcher was only refreshing changes to non-targeted plugin stylesheets.
This commit is contained in:
Penar Musaraj 2020-01-08 13:25:36 -05:00
parent 2683b7793b
commit 2d84bea653
1 changed files with 7 additions and 1 deletions

View File

@ -109,7 +109,13 @@ module Stylesheet
def plugin_assets_refresh(plugin_name)
Stylesheet::Manager.clear_plugin_cache!(plugin_name)
message = Stylesheet::Manager.stylesheet_data(plugin_name.to_sym, Stylesheet::Watcher.theme_id)
targets = [plugin_name]
targets.push("#{plugin_name}_mobile") if DiscoursePluginRegistry.stylesheets_exists?(plugin_name, :mobile)
targets.push("#{plugin_name}_desktop") if DiscoursePluginRegistry.stylesheets_exists?(plugin_name, :desktop)
message = targets.map! do |name|
Stylesheet::Manager.stylesheet_data(name.to_sym, Stylesheet::Watcher.theme_id)
end.flatten!
MessageBus.publish '/file-change', message
end