class Emcee::Processors::StylesheetProcessor
StylesheetProcessor
scans a document for external stylesheet references and inlines them into the current document.
Public Class Methods
new(resolver)
click to toggle source
# File lib/emcee/processors/stylesheet_processor.rb, line 6 def initialize(resolver) @resolver = resolver end
Public Instance Methods
process(doc)
click to toggle source
# File lib/emcee/processors/stylesheet_processor.rb, line 10 def process(doc) inline_styles(doc) doc end
Private Instance Methods
inline_styles(doc)
click to toggle source
# File lib/emcee/processors/stylesheet_processor.rb, line 17 def inline_styles(doc) doc.style_references.each do |node| path = @resolver.absolute_path(node.path) return unless @resolver.should_inline?(path) content = @resolver.evaluate(path) node.replace("style", content) @resolver.depend_on_asset(path) end end