module Roda::RodaPlugins::Assets::InstanceMethods

def assets(type, attrs = nil)

result in a single tag to the compiled asset file.
tag for each asset file. When the assets are compiled, this will
When the assets are not compiled, this will result in a separate

the type, such as [:css, :frontend].
To return the tags for a specific asset group, use an array for

the :css type.
This will use a script tag for the :js type and a link tag for
Return a string containing html tags for the given asset type.
def assets(type, attrs = nil)
  o = self.class.assets_opts
  type, *dirs = type if type.is_a?(Array)
  stype = type.to_s
  attrs = if attrs
    ru = Rack::Utils
    attrs.map{|k,v| "#{k}=\"#{ru.escape_html(v.to_s)}\""}.join(SPACE)
  else
    EMPTY_STRING
  end
  if type == :js
    tag_start = "<script type=\"text/javascript\" #{attrs} src=\""
    tag_end = JS_END
  else
    tag_start = "<link rel=\"stylesheet\" #{attrs} href=\""
    tag_end = CSS_END
  end
  url_prefix = request.script_name if self.class.opts[:add_script_name]
  # Create a tag for each individual file
  if compiled = o[:compiled]
    if dirs && !dirs.empty?
      key = dirs.join(DOT)
      ckey = "#{stype}.#{key}"
      if ukey = compiled[ckey]
        "#{tag_start}#{url_prefix}/#{o[:"compiled_#{stype}_prefix"]}.#{key}.#{ukey}.#{stype}#{tag_end}"
      end
    elsif ukey = compiled[stype]
      "#{tag_start}#{url_prefix}/#{o[:"compiled_#{stype}_prefix"]}.#{ukey}.#{stype}#{tag_end}"
    end
  else
    asset_dir = o[type]
    if dirs && !dirs.empty?
      dirs.each{|f| asset_dir = asset_dir[f]}
      prefix = "#{dirs.join(SLASH)}/" if o[:group_subdirs]
    end
    Array(asset_dir).map{|f| "#{tag_start}#{url_prefix}/#{o[:"#{stype}_prefix"]}#{prefix}#{f}#{o[:"#{stype}_suffix"]}#{tag_end}"}.join(NEWLINE)
  end
end