Ruby HTML templating gem
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Templette 0.5.2

A Ruby static HTML templating gem.


Templette was created to make it easy to create and maintain static websites. It provides a (hopefully) simple structure of pages, templates and helpers. Templates are the universal page layouts. Pages are the unique content of a page.

Use me

Use templette <site-name> to generate the framework basics.

rake build

Generates the full documents in an 'out' folder in the site root.

For more information on available rake tasks, check out FileGenerator.

For more info on creating pages, look at Templette::Page.

Haml or ERB

Template rendering supports multiple rendering engines now, with one or two more to arrive shortly. Simply name templates with their rendering engine name as the final file extension. Like `template.html.haml`. More details are in Templette::Template.

Now the internal html snippets can be rendered from erb or haml as well. This is handy if you prefer to maintain your markup as haml, or if you have parts of your site that could be DRYer. Instead of specifying a file as `file:text.html`, now you can write `render text.html.haml`.

Helper support

Automate content and avoid having to update transient information. By default, a helper will automatically load a helper that shares its name. Any methods loaded in the helper will be available to the template at build time.

Definable site root

A subdirectory can be set as the project root. Generated page and resource directories will be built into a given subdirectory. An example can be found in the config.rb file generated in new projects, or by running rake generate:config.

Standard tag methods

Rendered html now supports `image_tag`, `stylesheet_tag` and `script_tag`. These methods will recognize a site root, as described above, and build links accordingly. Documentation on the individual methods is in Templette::Helpers.

Site resources

Additional resources for a site such as css and images can be managed and built into the site using the resources directory. All files within the resources dir get copied into your output directory upon build.


Run rake preview to see your project in a web browser. The preview task will build your project in a temporary 'preview' directory. WEBrick will boot and serve your project up on localhost:4444.