https://github.com/uswitch/rack-ssi
Rack middleware for SSI processing, based on nginx HttpSsiModule
https://github.com/uswitch/rack-ssi
Last synced: 10 months ago
JSON representation
Rack middleware for SSI processing, based on nginx HttpSsiModule
- Host: GitHub
- URL: https://github.com/uswitch/rack-ssi
- Owner: uswitch
- License: mit
- Created: 2012-08-07T09:33:41.000Z (almost 14 years ago)
- Default Branch: master
- Last Pushed: 2020-11-02T16:05:35.000Z (over 5 years ago)
- Last Synced: 2025-08-14T00:36:21.608Z (11 months ago)
- Language: Ruby
- Size: 30.3 KB
- Stars: 2
- Watchers: 51
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Rack::SSI
Rack middleware for processing SSI based on the [nginx HttpSsiModule](http://wiki.nginx.org/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
```ruby
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
```ruby
config.middleware.use Rack::SSI, { ... }
```
#### Haml
To use includes in your HAML, the following should work ok:
```ruby
!!!
%html{:xmlns => "http://www.w3.org/1999/xhtml"}
%head
%title My site
/ #include file="/includes/header.html"
```