asset helpers
This commit is contained in:
parent
e3c6ef78c9
commit
e670940909
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -10,6 +10,3 @@
|
|||
[submodule "vendor/sinatra-content-for"]
|
||||
path = vendor/sinatra-content-for
|
||||
url = git://github.com/foca/sinatra-content-for.git
|
||||
[submodule "vendor/sinatra-helpers"]
|
||||
path = vendor/sinatra-helpers
|
||||
url = git://github.com/sbfaulkner/sinatra-helpers.git
|
||||
|
|
|
@ -12,9 +12,6 @@ require File.join(File.dirname(__FILE__), '..', 'vendor', 'sinatra-maruku', 'lib
|
|||
# Include content_for support
|
||||
require File.join(File.dirname(__FILE__), '..', 'vendor', 'sinatra-content-for', 'lib', 'sinatra', 'content_for')
|
||||
|
||||
# Include common haml/html helper support
|
||||
require File.join(File.dirname(__FILE__), '..', 'vendor', 'sinatra-helpers', 'lib', 'sinatra-helpers', 'haml')
|
||||
|
||||
class Middleman < Sinatra::Base
|
||||
set :app_file, __FILE__
|
||||
set :static, true
|
||||
|
@ -24,9 +21,6 @@ class Middleman < Sinatra::Base
|
|||
helpers Sinatra::Markaby
|
||||
helpers Sinatra::Maruku
|
||||
helpers Sinatra::ContentFor
|
||||
helpers Sinatra::Helpers::Haml::Forms
|
||||
helpers Sinatra::Helpers::Haml::Links
|
||||
helpers Sinatra::Helpers::Haml::Partials
|
||||
|
||||
def self.run!(options={}, &block)
|
||||
set options
|
||||
|
@ -51,7 +45,6 @@ class Middleman < Sinatra::Base
|
|||
end
|
||||
|
||||
configure do
|
||||
puts "config yo"
|
||||
Compass.configuration do |config|
|
||||
config.project_path = Dir.pwd
|
||||
config.sass_dir = File.join(File.basename(self.views), "stylesheets")
|
||||
|
|
|
@ -15,7 +15,21 @@ Middleman.helpers do
|
|||
classes.join(' ')
|
||||
end
|
||||
|
||||
def asset_url(path, tld_length = 1)
|
||||
"/#{path}"
|
||||
def asset_url(path)
|
||||
path.include?("://") ? path : "/#{path}"
|
||||
end
|
||||
|
||||
def image_tag(path, options={})
|
||||
options[:alt] ||= ""
|
||||
capture_haml do
|
||||
haml_tag :img, options.merge(:src => asset_url(path))
|
||||
end
|
||||
end
|
||||
|
||||
def stylesheet_link_tag(path, options={})
|
||||
options[:rel] ||= "stylesheet"
|
||||
capture_haml do
|
||||
haml_tag :link, options.merge(:href => asset_url(path), :type => "text/css")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
1
vendor/sinatra-helpers
vendored
1
vendor/sinatra-helpers
vendored
|
@ -1 +0,0 @@
|
|||
Subproject commit 65d5060ad8cdff6b12631878d97486114d195376
|
Loading…
Reference in a new issue