Skip to content

A Sinatra extension that turns a Sinatra app into a one page app using the teamwork of Sammy.

Notifications You must be signed in to change notification settings

quirkey/sinatra-sammy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sinatra-sammy

code.quirkey.com/sammy

DESCRIPTION:

A Sinatra extension that turns a Sinatra app into a one page app using the teamwork of Sammy.

FEATURES:

Three lines of code will give turn your one sinatra app into a one page app.

First,

sudo gem install sinatra-sammy

Next, in your app:

require 'sinatra'
require 'sinatra-sammy' # Add me!

class MyApp < Sinatra::Default

  register Sinatra::Sammy # Add me !

  get '/' do
    haml :index
  end

  # ...
end

Finally, in your layout:

!!!
%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 test_app2
    / Set :element_selector to the element that 'yields'
    = sammy(:element_selector => '#main')
  %body
    #main
      = yield

Done. One pager, without sacrificing SEO.

REQUIREMENTS:

Sinatra, a sinatra app, love of the universe.

INSTALL:

sudo gem install sinatra-sammy

LICENSE:

(The MIT License)

Copyright © 2009 Aaron Quint, Quirkey NYC, LLC.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

A Sinatra extension that turns a Sinatra app into a one page app using the teamwork of Sammy.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages