module Roda::RodaPlugins::Assets::RequestMethods

Public Instance Methods

assets() click to toggle source

Handles calls to the assets route

# File lib/roda/plugins/assets.rb, line 263
def assets
  on self.class.assets_route_regex do |type, file|
    content_type = type == 'css' ? 'text/css' : 'application/javascript'

    response.headers.merge!({
      "Content-Type" => content_type + '; charset=UTF-8',
    }.merge(scope.assets_opts[:headers]))

    scope.render_asset file, type
  end
end