DEV: Ensure the correct plugin stylesheets are reloaded in development

DEV: Ensure the correct plugin stylesheets are reloaded in development

If a plugin name contained the name of another plugin, the wrong stylesheets would be reloaded. For example, working on discourse-prometheus-alert-receiver would cause discourse-prometheus stylesheets to be reloaded.

diff --git a/lib/stylesheet/watcher.rb b/lib/stylesheet/watcher.rb
index 908e5b3..089c064 100644
--- a/lib/stylesheet/watcher.rb
+++ b/lib/stylesheet/watcher.rb
@@ -61,7 +61,7 @@ module Stylesheet
               paths.map! do |long|
                 plugin_name = nil
                 plugins_paths.each do |plugin_path|
-                  if long.include?(plugin_path)
+                  if long.include?("#{plugin_path}/")
                     plugin_name = File.basename(plugin_path)
                     break
                   end

GitHub sha: 76c02cac

2 Likes