by blahed

blahed / frank

Static Site Non-Framework

417 Stars 29 Forks Last release: Not found MIT License 237 Commits 31 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:


Inspired by Sinatra's simplicity and ease of use, Frank lets you build static sites using your favorite libs. Frank has a built in development server for previewing work as you develop, an "export" command for compiling and saving your work out to static html and css, and a publish command for copying your exported pages to a server.

Frank uses Tilt, so it comes with support for Haml & Sass, LESS, Builder, ERB, and Liquid.


Create a new project with:

$ frank new 


and start up the server with:
$ frank server

Frank's holdin' it down...

And you're ready to get to work. By default, dynamic templates are served from the

folder, static files are served from the
folder, and layouts are served from the

When you're done working:

$ frank export 

to compile templates and copy them--along with static your assets--into

 (or to 
if you don't specify an


$ frank export --production 

to compile & copy over, but organized to work as a static website in production. (e.g. folders named after your views, with an


You can add publish settings in setup.rb and publish directly to a server via scp.

$ frank publish


As of version 0.4, Frank no longer uses settings.yml. However you can use

frank upgrade
in order convert your old settings.yml to the new setup.rb format.

Frank Templates

Frank (as of 1.0) has support for saving "templates" in

. This is very handy if find yourself wanting a custom starting point. All you have to do to use the feature is create a
folder and start putting templates in it.

Once you have a few templates saved, when you run

frank new 
you'll be presented with a list of templates to choose from as the starting point for the project.

Views & Meta Data

All of your templates, less, sass &c. go into

by default. You can organize them into subfolders if you've got lots.


Writing views is simple. Say you've got a

; just browse over to
and your view will be parsed and served up as html.

Meta Data

Frank was designed to make controllers unnecessary. But, sometimes it's nice to have variables in your templates / layouts. This is particularly handy if you want to set the page title (in the layout) according to the view. This is simple, now, with meta data.

Meta fields go at the top of any view, and are written in YAML. To mark the end of the meta section, place the meta delimeter,

, on a blank line. You can use as many hyphens as you'd like (as long as there are 3).

Meta fields are then available as local variables to all templating languages that support them--in the view & layout:

  title: My Rad Page
  author: My Rad Self

%h1= title %h3= 'By ' + author

layout: %title= title + '--My Rad Site'

Layouts (updated in 0.3)

Layouts are also simple with Frank. Create a

, etc.), in the
folder, and include a
somewhere therein; views using the layout will be inserted there.

Namespacing Layouts

You can namespace your layouts using folders:

  • When rendering a view--
  • Frank would first look for the layout
  • and if not found use fall back on

Multiple/No Layouts

Frank also supports choosing layouts on a view-by-view basis via meta data. Just add a

meta field:
layout: my_layout.haml
%h1 I'm using my_layout.haml instead of default.haml!

or if you don't want a layout at all:

layout: nil
%h1 No layout here!

Partials & Helpers

Frank comes with a helper method,

, for including partials in your views.

You can also add your own helper methods easily.


To create a partial, make a new file like any of your other views, but prefix its name with an underscore.

For example, if I have a partial named

, I can include this in my Haml views like this:
= render_partial 'footer'

You can also send local variables to partials like this:

= render_partial 'footer', :local_variable_name => 'some_value'


Helper methods are also easy. Just open up

and add your methods to the
module; that's it. Use them just like

Built-in Helpers


Frank has a handy automatic page refreshing helper. Just include

= refresh
(or equivalent) in your view, and Frank will automatically refresh the page for you whenever you save a project file. This eliminates the tedium of hundreds of manual refreshes over the course of building a project.

When it's time export with

frank export
, Frank will leave out the JavasScript bits of the refresher.

Current Path

Frank now has a

variable that you can use to set selected states on nav items. It will return the path info from the template being processed. You also, have access to the variable from layouts and from the
frank export

Placeholder Text

You can easily generate dummy text like so:

 %p= lorem.sentences 3

This will return 3 sentences of standard Lorem Ipsum.

also has all of the following methods for generating dummy text:
 lorem.sentence     # returns a single sentence
 lorem.words 5      # returns 5 individual words
 lorem.paragraphs 10
 lorem.paragraph         # accepts a strftime format argument

Placeholder Images

Frank now uses for placeholder images, the

helper supports backgroundcolor, color, randomcolor, and text options:
 lorem.image('300x400')                                               #=>
 lorem.image('300x400', :background_color => '333', :color => 'fff')  #=>
 lorem.image('300x400', :random_color => true)                        #=>
 lorem.image('300x400', :text => 'blah')                              #=>

Replacement Text

All of the lorem helpers accept an optional "replacement" argument. This will be the text rendered when you

frank export

For example

will generate a lorem sentence when you view the page using the
frank server
for development. However, when you
frank export
the template will render "<%= page.content %>". This is useful if you plan on moving a frank project into a framework. (e.g. rails, sinatra, django, etc)



, you can change your folder names, and server port & host name. Check the comments there if you need help.


$ gem install frank

Contributors (in no particular order)

  • railsjedi (Jacques Crocker)
  • asymmetric (Lorenzo Manacorda)
  • timmywil (timmywil)
  • sce (Sten Christoffer Eliesen)
  • btelles (Bernie Telles)
  • mitchellbryson (Mitchell Bryson)
  • nwah (Noah Burney)

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.