Project

rack_ssi

0.01
No commit activity in last 3 years
No release in over 3 years
Rack middleware for processing SSI based on the nginx HttpSsiModule. Directives currently supported: 'block' and 'include'
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 10.4.2
~> 3.2

Runtime

 Project Readme

Rack::SSI

Rack middleware for processing SSI based on the nginx HttpSsiModule. Directives currently supported: block and include

Installation

Add this line to your application's Gemfile:

gem 'rack_ssi'

And then execute:

$ bundle

Or install it yourself as:

$ gem install rack_ssi

Usage

require 'rack_ssi'

Sinatra

configure do
  use Rack::SSI, {
    :logging => :on,
    :when => lambda {|env| not env['SOME_CUSTOM_HEADER'] == 'ON'},
    :locations => {
      %r{^/includes} => "http://includes.mydomain.com",
      %r{\A/path/} => ->(location) { "http://host#{rewrite(location)}" },
    },
    headers: ->(env) { hash_of_headers(env) }, # by default bypasses Cookies
  }
end

Rails

config.middleware.use Rack::SSI, { ... }

Haml

To use includes in your HAML, the following should work ok:

!!!
%html{:xmlns => "http://www.w3.org/1999/xhtml"}
  %head
    %title My site
      / #include file="/includes/header.html"