mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 09:14:40 +08:00
DEV: Improve CSS watcher perf (#21784)
Target only stylesheet directories. Should help with listen/fsevent choking.
This commit is contained in:
@ -21,7 +21,9 @@ module Stylesheet
|
|||||||
@default_paths = ["app/assets/stylesheets"]
|
@default_paths = ["app/assets/stylesheets"]
|
||||||
Discourse.plugins.each do |plugin|
|
Discourse.plugins.each do |plugin|
|
||||||
if plugin.path.to_s.include?(Rails.root.to_s)
|
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
|
else
|
||||||
# if plugin doesn’t seem to be in our app, consider it as outside of the app
|
# if plugin doesn’t seem to be in our app, consider it as outside of the app
|
||||||
# and ignore it
|
# and ignore it
|
||||||
@ -41,7 +43,7 @@ module Stylesheet
|
|||||||
end
|
end
|
||||||
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"]
|
listener_opts[:force_polling] = true if ENV["FORCE_POLLING"]
|
||||||
|
|
||||||
Thread.new do
|
Thread.new do
|
||||||
|
Reference in New Issue
Block a user