From 800760e353b12aa1f83bfe89dae042d175f4a6cb Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 9 Mar 2018 17:47:57 +1100 Subject: [PATCH] also watch CSS in unicorn on dev --- config/environments/development.rb | 2 +- lib/stylesheet/watcher.rb | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/config/environments/development.rb b/config/environments/development.rb index d9c10db2e8a..94a96f10848 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -52,7 +52,7 @@ Discourse::Application.configure do config.developer_emails = emails.split(",").map(&:downcase).map(&:strip) end - if defined?(Rails::Server) || defined?(Puma) + if defined?(Rails::Server) || defined?(Puma) || defined?(Unicorn) require 'stylesheet/watcher' STDERR.puts "Starting CSS change watcher" @watcher = Stylesheet::Watcher.watch diff --git a/lib/stylesheet/watcher.rb b/lib/stylesheet/watcher.rb index f0778b38dc2..952118ba454 100644 --- a/lib/stylesheet/watcher.rb +++ b/lib/stylesheet/watcher.rb @@ -68,9 +68,12 @@ module Stylesheet Stylesheet::Manager.cache.clear message = ["desktop", "mobile", "admin"].map do |name| - { target: name, new_href: Stylesheet::Manager.stylesheet_href(name.to_sym) , theme_key: SiteSetting.default_theme_key } + { + target: name, + new_href: Stylesheet::Manager.stylesheet_href(name.to_sym), + theme_key: SiteSetting.default_theme_key + } end - MessageBus.publish '/file-change', message end