DEV: Improve CSS watcher perf (#21784)

Target only stylesheet directories. Should help with listen/fsevent choking.
This commit is contained in:
Jarek Radosz 2023-05-29 10:07:09 +02:00 committed by GitHub
parent 5bf2dca24a
commit ac0f5ca1b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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