A sample repository to demonstrate Guard-Steering and Steering Ruby gems on some Handlebars templates and partials.
Steering is a Ruby wrapper for the Handlebars library, making it possible to compile and precompile templates, using the magic of the ExecJS engine.
Now having all these out of the way let's see how to get set up:
- Install RubyGems and Bundler if you haven't done so yet
- Clone this repository and run
bundle installon the command line inside the main folder (Bundler is configured to install everything under
vendorin the project folder, so don't worry about your system being messed up)
- Load each example into your favourite browser to first see how the templates are not working yet, only placeholder text is going to be displayed
bundle exec guardon the command line and you should see messages telling you that Guard-Steering has created the precompiled templates
- Reload the examples in your browser and if everything went well you should see the templates nicely rendered
If you haven't done so, take a look at the
Guardfile and the example folders to understand what has just happened.
A very simple example, a placeholder
div will be replaced by small template.
In this example a list is generated with a few items. The trick is that the list itself is also a template, which then renders the list item template as partial.
In order to make this possible, you have to use the
:register_partials => true option in the
Public domain – do whatever you feel like with it!