mirror of
https://github.com/discourse/discourse.git
synced 2026-08-13 06:25:11 -05:00
DEV: fix live refresh if you have a custom theme selected in dev
This commit is contained in:
@@ -58,6 +58,16 @@ class ApplicationController < ActionController::Base
|
|||||||
|
|
||||||
layout :set_layout
|
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?
|
def has_escaped_fragment?
|
||||||
SiteSetting.enable_escaped_fragments? && params.key?("_escaped_fragment_")
|
SiteSetting.enable_escaped_fragments? && params.key?("_escaped_fragment_")
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,6 +3,14 @@ require 'listen'
|
|||||||
module Stylesheet
|
module Stylesheet
|
||||||
class Watcher
|
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)
|
def self.watch(paths = nil)
|
||||||
watcher = new(paths)
|
watcher = new(paths)
|
||||||
watcher.start
|
watcher.start
|
||||||
@@ -71,7 +79,7 @@ module Stylesheet
|
|||||||
{
|
{
|
||||||
target: name,
|
target: name,
|
||||||
new_href: Stylesheet::Manager.stylesheet_href(name.to_sym),
|
new_href: Stylesheet::Manager.stylesheet_href(name.to_sym),
|
||||||
theme_key: SiteSetting.default_theme_key
|
theme_key: Stylesheet::Watcher.theme_key
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
MessageBus.publish '/file-change', message
|
MessageBus.publish '/file-change', message
|
||||||
|
|||||||
Reference in New Issue
Block a user