Skip to content

Latest commit

 

History

History
46 lines (31 loc) · 1.86 KB

app.textile

File metadata and controls

46 lines (31 loc) · 1.86 KB

:title: The TinySite app
:description: The TinySite app is a simple and small (130LOC) ruby rack application.

++++body++++

The TinySite app

The app itself is really, really simple. All you need to get started is a config.ru file:

require 'tiny_site'

use Rack::ContentLength

run TinySite.new :file_path => 'http://dl.dropbox.com/u/[user_id]/my_site'

The file path would be the folder in which the page content files are available. Other supported parameters are :image_path (defaults to [file_path]/images) and cache_buster (a query string with which you can bust the internal cache and prevent HTTP caching for the given site). The :image_path helps to keep urls of images in your textile short. Image tags which don’t start with ‘http://’ or ‘/’ will be prefixed by the :image_path.

Of course you will want to serve some assets, too. Given these files and folders:

config.ru
layout.haml
public/
  javascript/
    my.js
  stylesheets/
    my.css

In this case the config.ru will more look like this:

require 'tiny_site'

use Rack::CommonLogger
use Rack::ContentLength
use Rack::Static, :urls => ['/stylesheets','/javascript'], :root => 'public'

run TinySite.new :cache_buster => 'preview',
                 :file_path => 'http://dl.dropbox.com/u/1343338/a_test',
                 :image_path => 'http://dl.dropbox.com/u/1343338/a_test/images',
                 :file_extension => :txt

The file_extension is configurable in case you need to use an editor that cannot edit .textile files. Some smartphone dropbox clients can only edit .txt files, like the TextDrop web client. I tried Droptext for iPhone and it works nicely! The textile extension can be added to the known extensions.