Skip to content

Instantly share code, notes, and snippets.

@ottodranik
Forked from datenimperator/Gemfile
Last active August 29, 2015 14:12
Show Gist options
  • Select an option

  • Save ottodranik/4dd11d9f83bc5157f65d to your computer and use it in GitHub Desktop.

Select an option

Save ottodranik/4dd11d9f83bc5157f65d to your computer and use it in GitHub Desktop.

Revisions

  1. @datenimperator datenimperator revised this gist Sep 10, 2012. 2 changed files with 15 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions application.css.scss
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    @import "bootstrap";

    body {
    padding-top: 80px;
    }
    10 changes: 10 additions & 0 deletions application.haml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    !!!
    %html
    %head
    %meta{:charset => "utf-8"}
    %title Sinatra, sprockets, compass, bootstrap-sass playing together
    %link{ rel: 'stylesheet', href: stylesheet_path('application.css') }/

    %body
    .container
    = yield
  2. @datenimperator datenimperator revised this gist Sep 10, 2012. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion swc_application.rb
    Original file line number Diff line number Diff line change
    @@ -18,6 +18,7 @@ class SwcApplication < Sinatra::Base
    assets.append_path "assets/#{type}"
    assets.append_path Compass::Frameworks['bootstrap'].templates_directory + "/../vendor/assets/#{type}"
    end
    assets.append_path 'assets/font'

    # Configure Sprockets::Helpers (if necessary)
    Sprockets::Helpers.configure do |config|
    @@ -26,6 +27,7 @@ class SwcApplication < Sinatra::Base
    config.digest = digest_assets
    config.public_path = public_folder
    end
    Sprockets::Sass.add_sass_functions = false

    set :haml, { :format => :html5 }
    end
    @@ -43,4 +45,4 @@ class SwcApplication < Sinatra::Base
    include RenderPartial
    end

    end
    end
  3. @datenimperator datenimperator revised this gist Sep 7, 2012. No changes.
  4. @datenimperator datenimperator created this gist Sep 7, 2012.
    19 changes: 19 additions & 0 deletions Gemfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    source :rubygems

    gem 'shotgun', :group=>:development

    gem 'rack-cache'
    gem 'sinatra', :require => 'sinatra/base'
    gem 'sinatra-support'

    gem 'haml'

    gem 'sprockets'
    gem 'sprockets-helpers'
    gem 'sprockets-sass'

    gem 'compass'
    gem 'bootstrap-sass'
    gem 'coffee-script'

    gem 'uglifier'
    11 changes: 11 additions & 0 deletions config.ru
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    require './swc_application'

    use Rack::Cache, verbose: false

    map SwcApplication.assets_prefix do
    run SwcApplication.assets
    end

    map '/' do
    run SwcApplication
    end
    46 changes: 46 additions & 0 deletions swc_application.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,46 @@
    require 'bundler'
    Bundler.require

    # Helpers
    require './lib/render_partial'

    class SwcApplication < Sinatra::Base
    set :root, File.dirname(__FILE__)
    set :assets, Sprockets::Environment.new(root)
    set :precompile, [ /\w+\.(?!js|css).+/, /application.(css|js)$/ ]
    set :assets_prefix, '/assets'
    set :digest_assets, false
    set(:assets_path) { File.join public_folder, assets_prefix }

    configure do
    # Setup Sprockets
    %w{javascripts stylesheets images}.each do |type|
    assets.append_path "assets/#{type}"
    assets.append_path Compass::Frameworks['bootstrap'].templates_directory + "/../vendor/assets/#{type}"
    end

    # Configure Sprockets::Helpers (if necessary)
    Sprockets::Helpers.configure do |config|
    config.environment = assets
    config.prefix = assets_prefix
    config.digest = digest_assets
    config.public_path = public_folder
    end

    set :haml, { :format => :html5 }
    end

    before do
    expires 500, :public, :must_revalidate
    end

    get '/' do
    haml :index, :layout => :'layouts/application'
    end

    helpers do
    include Sprockets::Helpers
    include RenderPartial
    end

    end