Skip to content

Instantly share code, notes, and snippets.

@erlend
Created May 7, 2014 08:44
Show Gist options
  • Select an option

  • Save erlend/3f16cac45dd64be5a36f to your computer and use it in GitHub Desktop.

Select an option

Save erlend/3f16cac45dd64be5a36f to your computer and use it in GitHub Desktop.

Revisions

  1. erlend created this gist May 7, 2014.
    27 changes: 27 additions & 0 deletions config.ru
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    require 'bundler'
    Bundler.setup :default
    require 'sinatra/base'
    require 'sprockets'
    require './app'

    map '/assets' do
    environment = Sprockets::Environment.new
    environment.append_path 'assets/javascripts'
    environment.append_path 'assets/stylesheets'
    environment.append_path 'assets/images'

    # Load assets from gems
    $:.each do |path|
    assets = File.join(path, "..", "vendor", "assets")
    ["javascripts", "stylesheets", "images"].each do |type|
    dir = File.join(assets, type)
    environment.append_path dir if File.directory?(dir)
    end
    end

    run environment
    end

    map '/' do
    run Sinatra::Application
    end