class Emcee::Processors::ImportProcessor
ImportProcessor
scans a file for html imports and adds them to the current required assets.
Public Class Methods
new(resolver)
click to toggle source
# File lib/emcee/processors/import_processor.rb, line 6 def initialize(resolver) @resolver = resolver end
Public Instance Methods
process(doc)
click to toggle source
# File lib/emcee/processors/import_processor.rb, line 10 def process(doc) require_assets(doc) remove_imports(doc) doc end
Private Instance Methods
remove_imports(doc)
click to toggle source
# File lib/emcee/processors/import_processor.rb, line 25 def remove_imports(doc) doc.html_imports.each do |node| node.remove end end
require_assets(doc)
click to toggle source
# File lib/emcee/processors/import_processor.rb, line 18 def require_assets(doc) doc.html_imports.each do |node| path = @resolver.absolute_path(node.path) @resolver.require_asset(path) end end