Class: Juicer::Merger::StylesheetMerger

Inherits:
Base
  • Object
show all
Defined in:
lib/juicer/merger/stylesheet_merger.rb

Overview

Merge several files into one single output file. Resolves and adds in files from @import statements

Instance Attribute Summary

Attributes inherited from Base

#dependency_resolver, #files

Instance Method Summary collapse

Methods inherited from Base

#append, #save

Methods included from Chainable

included, #next_in_chain, #next_in_chain=

Constructor Details

#initialize(files = [], options = {}) ⇒ StylesheetMerger

Constructor

Options:

  • :document_root - Path to web root if there is any @import statements using absolute URLs



19
20
21
22
23
24
25
26
27
28
# File 'lib/juicer/merger/stylesheet_merger.rb', line 19

def initialize(files = [], options = {})
  @dependency_resolver = CssDependencyResolver.new(options)
  super(files || [], options)
  @hosts = options[:hosts] || []
  @host_num = 0
  @use_absolute = options.key?(:absolute_urls) ? options[:absolute_urls] : false
  @use_relative = options.key?(:relative_urls) ? options[:relative_urls] : false
  @document_root = options[:document_root]
  @document_root = File.expand_path(@document_root).sub(/\/?$/, "") if @document_root # Make sure path doesn't end in a /
end