mirror of
https://github.com/discourse/discourse.git
synced 2024-12-02 20:05:14 +08:00
33 lines
652 B
Ruby
33 lines
652 B
Ruby
|
class Plugin::Theme
|
||
|
attr_reader :color_scheme
|
||
|
|
||
|
def initialize(plugin, name)
|
||
|
@plugin = plugin
|
||
|
@name = name
|
||
|
end
|
||
|
|
||
|
def css(name)
|
||
|
@plugin.register_asset("stylesheets/#{name}.scss")
|
||
|
end
|
||
|
|
||
|
def set_color_scheme(scheme)
|
||
|
@color_scheme = scheme
|
||
|
end
|
||
|
|
||
|
def register_public
|
||
|
public_dir = "#{@plugin.directory}/public"
|
||
|
if File.exist?(public_dir)
|
||
|
if Rails.env.development?
|
||
|
Rails.application.config.before_initialize do |app|
|
||
|
app.middleware.insert_before(
|
||
|
::ActionDispatch::Static,
|
||
|
::ActionDispatch::Static,
|
||
|
public_dir
|
||
|
)
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
|