module DirectInject::PublicApi

Public Instance Methods

render_image( *sources ) click to toggle source
# File lib/direct_inject/public_api.rb, line 9
def render_image( *sources )
  render *sources do | asset , options |
    options.set \
      'data',
      'direct_inject_type',
      'image'

    encoded = data_uri_for asset

    Templates::Image.render \
      encoded,
      options
  end
end
render_javascript( *sources ) click to toggle source
# File lib/direct_inject/public_api.rb, line 24
def render_javascript( *sources )
  options = Map.opts! sources

  options.set \
    'type',
    :javascript

  sources.push options

  render *sources do | asset , options |
    options.set \
      'data',
      'direct_inject_type',
      'javascript'

    options.set \
      'type',
      'text/javascript'

    Templates::Javascript.render \
      asset.to_s,
      options
  end
end
render_stylesheet( *sources ) click to toggle source
# File lib/direct_inject/public_api.rb, line 49
def render_stylesheet( *sources )
  options = Map.opts! sources

  options.set \
    'type',
    :stylesheet

  sources.push options

  render *sources do | asset , options |
    options.set \
      'data',
      'direct_inject_type',
      'stylesheet'

    options.set \
      'type',
      'text/css'

    Templates::Stylesheet.render \
      asset.to_s,
      options
  end
end