snack

Getting Started

% gem install snack
% snack new myapp       # initialize snack
% snack serve myapp     # start the server for development (can also do 'snack serve' within app directory)
When you're ready to compile the site into html, css, and js:
% snack build myapp
You should see the compiled files in the current directory.

Layouts

By default, snack does not render templates within layouts. If you would like your templates to render within a layout, assign the layout's path to @layout. The path should be relative to the snack root.

# in index.html.haml
@layout = 'path/to/layouts/application'

Partials

You can use partials to break complex views up into manageable chunks. To render a partial, use the partial function. It takes a path relative to the snack root.

# in index.html.haml
= partial 'path/to/partials/my_partial', :album => 'Pinkerton', :band => 'Weezer'
As you can see, you may also pass optional local variables to render within the partial. Snack assumes that the filenames of your partials begin with an underscore. For the example above, snack would actually look for a partial named '_my_partial.html.haml'.