Class: CriticalPathCss::Rails::ConfigLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/critical_path_css/rails/config_loader.rb

Constant Summary collapse

CONFIGURATION_FILENAME =
'critical_path_css.yml'.freeze

Instance Method Summary collapse

Instance Method Details

#loadObject



6
7
8
9
10
11
12
13
14
15
# File 'lib/critical_path_css/rails/config_loader.rb', line 6

def load
  config = YAML.safe_load(ERB.new(File.read(configuration_file_path)).result, [], [], true)[::Rails.env]
  config['css_path'] = "#{::Rails.root}/public" + (
      config['css_path'] ||
        ActionController::Base.helpers.stylesheet_path(
          config['manifest_name'], host: ''
        )
  )
  config
end