This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get "/stylesheets/screen.css" do | |
content_type 'text/css' | |
# Use views/stylesheets & blueprint's stylesheet dirs in the Sass load path | |
sass :"stylesheets/screen", { :sass => { :load_paths => ( | |
[ File.join(File.dirname(__FILE__), 'views', 'stylesheets') ] + | |
Compass::Frameworks::ALL.map { |f| f.stylesheets_directory }) | |
} } | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sass(template, options={}, &block) | |
require 'sass' unless defined? ::Sass | |
options[:layout] = false | |
render :sass, template, options | |
end | |
def render_sass(template, data, options, &block) | |
engine = ::Sass::Engine.new(data, options[:sass] || {}) | |
engine.render | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get "/stylesheets/screen.css" do | |
content_type 'text/css' | |
sass :"stylesheets/screen" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get "/stylesheets/screen.css" do | |
content_type 'text/css' | |
response['Expires'] = (Time.now + 60*60*24*356*3).httpdate | |
sass :"stylesheets/screen" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
helpers do | |
def versioned_stylesheet(stylesheet) | |
"/stylesheets/#{stylesheet}.css?" + File.mtime(File.join(Sinatra::Application.views, "stylesheets", "#{stylesheet}.sass")).to_i.to_s | |
end | |
def versioned_js(js) | |
"/javascripts/#{js}.js?" + File.mtime(File.join(Sinatra::Application.public, "javascripts", "#{js}.js")).to_i.to_s | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!!! Strict | |
%html{:xmlns =>'http://www.w3.org/1999/xhtml', 'xml:lang' => 'en', :lang => 'en'} | |
%head | |
%meta{'http-equiv' => 'Content-Type', :content => 'text/html; charset=utf-8'}/ | |
%title My Sinatra App | |
%link{:href => versioned_stylesheet('screen'), :media => 'screen', :rel => 'stylesheet', :type => 'text/css'}/ | |
%script{:src => versioned_javascript('application'), :type => 'text/javascript'}/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
helpers do | |
def cycle | |
@_cycle ||= reset_cycle | |
@_cycle = [@_cycle.pop] + @_cycle | |
@_cycle.first | |
end | |
def reset_cycle | |
@_cycle = %w(even odd) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%table.tickets{:cellpadding => 0, :cellspacing => 0} | |
%thead | |
%tr | |
%th No. | |
%th Summary | |
%th Reporter | |
%th Assignee | |
%th Updated | |
%tbody | |
- reset_cycle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'chriseppstein-compass', '~> 0.4' | |
require 'compass' | |
configure do | |
Compass.configuration do |config| | |
config.project_path = File.dirname(__FILE__) | |
config.sass_dir = File.join('views', 'stylesheets') | |
end | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1. Create dirs for unpacking your source code and installing your apps | |
mkdir $HOME/src | |
mkdir $HOME/apps | |
# 2. Install the latest version of git | |
cd $HOME/src | |
wget http://kernel.org/pub/software/scm/git/git-1.6.1.3.tar.gz | |
tar zxvf git-1.6.1.3.tar.gz | |
cd git-1.6.1.3 | |
./configure --prefix=$HOME/apps NO_MMAP=1 |
OlderNewer