jdunphy / templette

Ruby HTML templating gem

This URL has Read+Write access

name age message
file .autotest Thu Feb 19 14:34:09 -0800 2009 Hey. I work with autotest now. [jdunphy]
file .gitignore Thu Jul 24 08:54:50 -0700 2008 Adding rake rdoc to the gem tasks. [jdunphy]
file History.rdoc Thu Mar 05 21:05:26 -0800 2009 Version bump before the output type changes. [jdunphy]
file README.rdoc Thu Mar 05 21:05:26 -0800 2009 Version bump before the output type changes. [jdunphy]
file Rakefile Fri Feb 20 09:54:48 -0800 2009 rcov [jdunphy]
file TODO Tue Mar 03 10:26:28 -0800 2009 updated TODO [sholder]
directory bin/ Fri Feb 20 12:58:39 -0800 2009 Refactoring the file generation, and sharing th... [jdunphy]
directory files/ Tue Feb 24 20:04:52 -0800 2009 Just clarifying the comment in the default conf... [jdunphy]
directory lib/ Sat Aug 15 19:35:12 -0700 2009 Now it doesn't look funny in emacs. [jdunphy]
file templette.gemspec Thu Mar 05 21:05:26 -0800 2009 Version bump before the output type changes. [jdunphy]
directory test/ Sat Apr 25 11:52:54 -0700 2009 Fixing a busted test. I shouldn't try to depend... [jdunphy]
directory test_site/ Tue Mar 03 13:15:37 -0800 2009 Removed hard-coding of html suffixes on generat... [sholder]
README.rdoc

Templette 0.5.2

A Ruby static HTML templating gem.

Why?

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.

Preview

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.