mirror of
https://github.com/discourse/discourse.git
synced 2025-02-06 11:28:18 +00:00
DEV: fix live refresh if you have a custom theme selected in dev
This commit is contained in:
parent
f9d2c69bbe
commit
ff90881238
@ -58,6 +58,16 @@ class ApplicationController < ActionController::Base
|
||||
|
||||
layout :set_layout
|
||||
|
||||
if Rails.env == "development"
|
||||
after_action :remember_theme_key
|
||||
|
||||
def remember_theme_key
|
||||
if @theme_key
|
||||
Stylesheet::Watcher.theme_key = @theme_key if defined? Stylesheet::Watcher
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def has_escaped_fragment?
|
||||
SiteSetting.enable_escaped_fragments? && params.key?("_escaped_fragment_")
|
||||
end
|
||||
|
@ -3,6 +3,14 @@ require 'listen'
|
||||
module Stylesheet
|
||||
class Watcher
|
||||
|
||||
def self.theme_key=(v)
|
||||
@theme_key = v
|
||||
end
|
||||
|
||||
def self.theme_key
|
||||
@theme_key || SiteSetting.default_theme_key
|
||||
end
|
||||
|
||||
def self.watch(paths = nil)
|
||||
watcher = new(paths)
|
||||
watcher.start
|
||||
@ -71,7 +79,7 @@ module Stylesheet
|
||||
{
|
||||
target: name,
|
||||
new_href: Stylesheet::Manager.stylesheet_href(name.to_sym),
|
||||
theme_key: SiteSetting.default_theme_key
|
||||
theme_key: Stylesheet::Watcher.theme_key
|
||||
}
|
||||
end
|
||||
MessageBus.publish '/file-change', message
|
||||
|
Loading…
x
Reference in New Issue
Block a user