Module: Sinatra::Assets

Defined in:
lib/stylio/assets.rb

Defined Under Namespace

Modules: Helpers

Class Method Summary collapse

Class Method Details

.registered(app) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/stylio/assets.rb', line 26

def self.registered(app)
  app.helpers Assets::Helpers
  app.get "/assets/application.css" do
    content_type("text/css")
    Sass::Engine.for_file(File.join(settings.app_path, "assets", "stylesheets", "application.scss"), {
      cache: false,
      syntax: :scss,
      style: :compressed
    }).render
  end

  %w(jpg png).each do |format|
    app.get "/assets/images/:image.#{format}" do |image|
      content_type("image/#{format}")
      File.join(options.assets, "images", "#{image}.#{format}")
    end
  end
end