From 2d84bea6537a3e3ca5a84bb7cf272219c9b8f183 Mon Sep 17 00:00:00 2001 From: Penar Musaraj Date: Wed, 8 Jan 2020 13:25:36 -0500 Subject: [PATCH] DEV: watch for changes to plugin mobile/desktop SCSS Previously, the watcher was only refreshing changes to non-targeted plugin stylesheets. --- lib/stylesheet/watcher.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/stylesheet/watcher.rb b/lib/stylesheet/watcher.rb index 7c56afbb8ca..4c9ab7f595c 100644 --- a/lib/stylesheet/watcher.rb +++ b/lib/stylesheet/watcher.rb @@ -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