Merge branch 'master' of github.com:johnbintz/attentive
This commit is contained in:
commit
f0afac6cc5
|
@ -0,0 +1,21 @@
|
||||||
|
module Compass::RailsImageFunctionPatch
|
||||||
|
private
|
||||||
|
|
||||||
|
def image_path_for_size(image_file)
|
||||||
|
begin
|
||||||
|
file = ::Attentive::Server.sprockets_env.find_asset(image_file)
|
||||||
|
return file
|
||||||
|
rescue ::Sprockets::FileOutsidePaths
|
||||||
|
return super(image_file)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
module Sass::Script::Functions
|
||||||
|
include Compass::RailsImageFunctionPatch
|
||||||
|
end
|
||||||
|
|
||||||
|
# Wierd that this has to be re-included to pick up sub-modules. Ruby bug?
|
||||||
|
class Sass::Script::Functions::EvaluationContext
|
||||||
|
include Sass::Script::Functions
|
||||||
|
end
|
|
@ -2,6 +2,7 @@ require 'sprockets'
|
||||||
require 'sprockets-vendor_gems'
|
require 'sprockets-vendor_gems'
|
||||||
require 'sprockets-sass'
|
require 'sprockets-sass'
|
||||||
require 'compass'
|
require 'compass'
|
||||||
|
require 'attentive/compass_patches'
|
||||||
require 'sinatra'
|
require 'sinatra'
|
||||||
require 'nokogiri'
|
require 'nokogiri'
|
||||||
require 'rdiscount'
|
require 'rdiscount'
|
||||||
|
@ -13,7 +14,23 @@ require 'rack/builder'
|
||||||
require 'forwardable'
|
require 'forwardable'
|
||||||
|
|
||||||
module Attentive
|
module Attentive
|
||||||
|
module Helpers
|
||||||
|
def image_path(path, options)
|
||||||
|
if resolve(path, options)
|
||||||
|
return "/assets/#{path}"
|
||||||
|
end
|
||||||
|
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
class Server < Rack::Builder
|
class Server < Rack::Builder
|
||||||
|
|
||||||
|
def self.sprockets_env
|
||||||
|
@sprockets_env ||= Sprockets::EnvironmentWithVendoredGems.new
|
||||||
|
end
|
||||||
|
|
||||||
def self.start(options)
|
def self.start(options)
|
||||||
require 'rack'
|
require 'rack'
|
||||||
require 'pygments'
|
require 'pygments'
|
||||||
|
@ -33,12 +50,13 @@ module Attentive
|
||||||
def self.call(env)
|
def self.call(env)
|
||||||
@app ||= Rack::Builder.new do
|
@app ||= Rack::Builder.new do
|
||||||
map '/assets' do
|
map '/assets' do
|
||||||
env = Sprockets::EnvironmentWithVendoredGems.new
|
env = ::Attentive::Server.sprockets_env
|
||||||
env.append_path 'assets/javascripts'
|
env.append_path 'assets/javascripts'
|
||||||
env.append_path 'assets/stylesheets'
|
env.append_path 'assets/stylesheets'
|
||||||
env.append_path 'assets/images'
|
env.append_path 'assets/images'
|
||||||
env.append_path Attentive.root.join('lib/assets/javascripts')
|
env.append_path Attentive.root.join('lib/assets/javascripts')
|
||||||
env.append_path Attentive.root.join('lib/assets/stylesheets')
|
env.append_path Attentive.root.join('lib/assets/stylesheets')
|
||||||
|
env.context_class.send(:include, ::Attentive::Helpers)
|
||||||
|
|
||||||
run env
|
run env
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
#slides-container
|
#slides-container
|
||||||
#slides= slides
|
#slides= slides
|
||||||
|
= haml :"_footer"
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
%head
|
%head
|
||||||
%title= Attentive.title
|
%title= Attentive.title
|
||||||
%script{:type => 'text/javascript', :src => 'assets/application.js'}
|
%script{:type => 'text/javascript', :src => 'assets/application.js'}
|
||||||
%link{:rel => 'stylesheet', :href => 'assets/application.css', :type => 'text/css'}/
|
|
||||||
%style{:type => 'text/css'}= Pygments.css
|
%style{:type => 'text/css'}= Pygments.css
|
||||||
|
%link{:rel => 'stylesheet', :href => 'assets/application.css', :type => 'text/css'}/
|
||||||
= haml :"_header"
|
= haml :"_header"
|
||||||
%body.loading
|
%body.loading
|
||||||
= yield
|
= yield
|
||||||
|
|
Loading…
Reference in New Issue