Repository is archived
No commit activity in last 3 years
No release in over 3 years
A quick and dirty static file router for Sinatra.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

Sinatra Wardrobe

A way to dress up Sinatra with static file routing based on a few params.

Require in your Gemfile

gem 'sinatra-wardrobe'

And use it with the suit_up! method.

suit_up! directories: './views', extensions: '.md'

Or, for a little more control:

suit_up! directories: ['./views/blog', './views/static'], extensions: ['.md', '.erb'], excludes: 'layout.erb', layout_engine: :erb

Defaults

By default, Sinatra::Wardrobe will look for files with a .md extension in the ./views directory, ignoring layout.erb and assuming a layout_engine of :erb.

Currently it only supports .erb, .md and .markdown but there are more to come.

Helpers

  • hats will return the array of Hash objects that Sinatra::Wardrobe uses to bind the get requests and serve your files.
  • hat_rack is an HTML helper that generates an (by default) unordered list with links to each of the files in the hats array.

MIT Licensed