module Roda::RodaPlugins::Assets::InstanceMethods
def render_asset(file, type)
In both cases, if the file has not been modified since the last request,
this will render the asset using the render plugin.
When assets are not compiled and the file is not already in the same format,
this returns the contents of the compiled file.
or when the file is already of the given type (no rendering necessary),
Render the asset with the given filename. When assets are compiled,
def render_asset(file, type) o = self.class.assets_opts if o[:compiled] file = "#{o[:"compiled_#{type}_path"]}#{file}" if o[:gzip] && env['HTTP_ACCEPT_ENCODING'] =~ /\bgzip\b/ @_response['Content-Encoding'] = 'gzip' file += '.gz' end check_asset_request(file, type, ::File.stat(file).mtime) ::File.read(file) else file = "#{o[:"#{type}_path"]}#{file}" check_asset_request(file, type, asset_last_modified(file)) read_asset_file(file, type) end end