Skip to content

A platform for community discussion. Free, open, simple.

DEV: Improve CSS watcher perf (#21784)

Jarek Radoszac0f5ca1b242
diff --git a/lib/stylesheet/watcher.rb b/lib/stylesheet/watcher.rb
index 8e41e6832a1..9740758d076 100644
--- a/lib/stylesheet/watcher.rb
+++ b/lib/stylesheet/watcher.rb
@@ -21,7 +21,9 @@ module Stylesheet
@default_paths = ["app/assets/stylesheets"]
Discourse.plugins.each do |plugin|
if plugin.path.to_s.include?(Rails.root.to_s)
- @default_paths << File.dirname(plugin.path).sub(Rails.root.to_s, "").sub(%r{\A/}, "")
+ path = File.dirname(plugin.path).sub(Rails.root.to_s, "").sub(%r{\A/}, "")
+ path << "/assets/stylesheets"
+ @default_paths << path if File.exist?(path)
else
# if plugin doesn’t seem to be in our app, consider it as outside of the app
# and ignore it
@@ -41,7 +43,7 @@ module Stylesheet
end
end
- listener_opts = { ignore: /xxxx/, only: /\.(css|scss)\z/ }
+ listener_opts = { ignore: [/node_modules/], only: /\.s?css\z/ }
listener_opts[:force_polling] = true if ENV["FORCE_POLLING"]
Thread.new do