Method: Mango::Application.render_stylesheet_template!

Defined in:
lib/mango/application.rb

.render_stylesheet_template!(uri_path) ⇒ Object

Given a URI path, attempts to render a stylesheet template, if it exists, and halt

Parameters:

See Also:



425
426
427
428
429
430
431
432
433
434
435
436
437
438
# File 'lib/mango/application.rb', line 425

def render_stylesheet_template!(uri_path)
  stylesheet_match = File.join(settings.stylesheets, "*")
  stylesheet_path  = File.expand_path(uri_path, settings.stylesheets)

  return unless File.fnmatch(stylesheet_match, stylesheet_path)

  STYLESHEET_TEMPLATE_ENGINES.each do |engine, extension|
    @preferred_extension = extension.to_s
    find_template(settings.stylesheets, uri_path, engine) do |file|
      next unless File.file?(file)
      halt send(extension, uri_path.to_sym, views: settings.stylesheets)
    end
  end
end