Class: Stylo::PipelineSteps::Stylesheet

Inherits:
Object
  • Object
show all
Defined in:
lib/stylo/pipeline_steps/stylesheet.rb

Instance Method Summary collapse

Instance Method Details

#call(response) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/stylo/pipeline_steps/stylesheet.rb', line 6

def call(response)
  raise 'You must set the asset location (Stylo::Config.options[:asset_location]) before stylo can be used.' if !Config.options[:asset_location]

  return if response.has_content? || response.extension != '.css'
  return unless content = AssetLoader.load_content(response.path)

  if Config.options[:css_combining_enabled]
    content = Combiner.new(REQUIRE_PATTERN).process(File.dirname(response.path), content)
  end

  response.set_body content, :css
end