Class: Classic::Railtie

Inherits:
Rails::Railtie
  • Object
show all
Defined in:
lib/classic/railtie.rb

Overview

Auto loader on style files change.

Class Method Summary collapse

Class Method Details

.watch_style_files(app) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/classic/railtie.rb', line 10

def self.watch_style_files(app)
  return unless Classic.object

  style_files = Classic.object.files.map { |f| Rails.root.join(f).to_s }
  reloader = app.config.file_watcher.new(style_files) {}
  app.reloaders << reloader
  app.reloader.to_run do
    reloader.execute_if_updated { Classic.reload! }
  end
end