Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Experimenting with adding sprockets

  • Loading branch information...
commit fcfce4d7d644e0d3cb6bd46fcdab02d273a86d7b 1 parent f602a6b
@bkeepers authored
View
2  Gemfile
@@ -4,6 +4,8 @@ gem 'sinatra'
gem 'rake'
gem 'toystore'
gem 'adapter-git', :git => 'git://github.com/bkeepers/adapter-git.git'
+gem 'sprockets', '~> 2.0.0.beta.15'
+gem 'sass'
group :test do
gem 'rspec'
View
8 Gemfile.lock
@@ -22,6 +22,7 @@ GEM
grit (2.4.1)
diff-lcs (~> 1.1)
mime-types (~> 1.15)
+ hike (1.2.1)
i18n (0.5.0)
linecache (0.46)
rbx-require-relative (> 0.0.4)
@@ -56,10 +57,15 @@ GEM
ruby-debug-base19 (>= 0.11.19)
ruby_core_source (0.1.5)
archive-tar-minitar (>= 0.5.2)
+ sass (3.1.7)
simple_uuid (0.1.2)
sinatra (1.2.6)
rack (~> 1.1)
tilt (< 2.0, >= 1.2.2)
+ sprockets (2.0.0.beta.15)
+ hike (~> 1.2)
+ rack (~> 1.0)
+ tilt (~> 1.1, != 1.3.0)
tilt (1.3.3)
toystore (0.8.2)
activemodel (~> 3.0)
@@ -77,5 +83,7 @@ DEPENDENCIES
rspec
ruby-debug
ruby-debug19
+ sass
sinatra
+ sprockets (~> 2.0.0.beta.15)
toystore
View
1  app/assets/javascripts/application.js
@@ -0,0 +1 @@
+//= require_tree .
View
1  app/assets/javascripts/tasks.js
@@ -0,0 +1 @@
+/* tasks.js */
View
3  app/assets/stylesheets/application.css
@@ -0,0 +1,3 @@
+/*
+*= require base
+*/
View
0  app/assets/stylesheets/base.scss
No changes.
View
8 config.ru
@@ -3,4 +3,10 @@ $: << File.expand_path('../lib', __FILE__)
require 'rubygems'
require 'gaskit'
-run Gaskit::App
+map '/assets' do
+ run Gaskit::App.sprockets
+end
+
+map '/' do
+ run Gaskit::App
+end
View
15 lib/gaskit/app.rb
@@ -1,6 +1,21 @@
module Gaskit
class App < Sinatra::Base
set :root, Gaskit.root
+ set :sprockets, Sprockets::Environment.new(root) { |env|
+ env.static_root = root.join('public', 'assets')
+ }
+
+ configure do
+ sprockets.append_path(root.join('app', 'assets', 'stylesheets'))
+ sprockets.append_path(root.join('app', 'assets', 'javascripts'))
+ sprockets.append_path(root.join('app', 'assets', 'images'))
+ end
+
+ helpers do
+ def asset_path(source)
+ settings.sprockets.path(source, true, "assets")
+ end
+ end
get '/' do
erb :dashboard
Please sign in to comment.
Something went wrong with that request. Please try again.