Skip to content


Subversion checkout URL

You can clone with
Download ZIP
A builder-like widget html generation framework.
Ruby HTML CSS JavaScript Shell ApacheConf

Merge pull request #68 from jkingdon/update-readme

Update opening paragraph and mention fortitude.
latest commit f99aecdad3
@jkingdon jkingdon authored
Failed to load latest commit information.
bin support for executing binary from inside a checked-out project dir
examples deprecate to_s in favor of to_html
lib update links from rubyforge to github pages (
spec silence deprecation warning
web update links from rubyforge to github pages (
.gemtest add .gemtest file for support
.rspec force install mysql gem on CI; move backtrace option to .rspec
Gemfile-rails update links from rubyforge to github pages (
Gemfile-rails.lock update some gemfiles and fix some tests
Gemfile-rails2 update links from rubyforge to github pages (
Gemfile-rails2.lock update some gemfiles and fix some tests
Gemfile-rails31 update links from rubyforge to github pages (
Gemfile-rails31.lock reorganise rake tasks for testing, update Gemfiles for integrations
History.txt prepare version 0.10.0
LICENSE.txt rip out Jeweler and Hoe Update opening paragraph and mention fortitude.
Rakefile update links from rubyforge to github pages (
VERSION.yml prepare version 0.10.0
api-announce.txt deprecate to_s in favor of to_html
clone_rails.rake prepare specs and rakefile for rails3 merge update docs; upgrade desired_ruby to ruby-1.9.2-p290
cruise_config.rb re-enable CI build emails
erector-todo.txt transfer repo to
install.rb copied from svn:// See …
uninstall.rb copied from svn:// See …



Erector is a view framework. That is, it helps you generate HTML mixing in dynamic content (like erb, slim or haml). Unlike erb, slim, or haml, views are objects, not template files, which allows the full power of object-oriented programming (inheritance, modular decomposition, encapsulation) in views. See the rdoc for the Erector::Widget class to learn how to make your own widgets, and visit the project site at for more documentation.

No, seriously, we've got hella docs at -- go check it out.


    require 'erector'

    class Hello < Erector::Widget
      def content
        html do
          head do
            title "Hello"
          body do
            text "Hello, "
            b @target, :class => 'big'
            text "!"
    end => 'world').to_html
    => "<html><head><title>Hello</title></head><body>Hello, <b class=\"big\">world</b>!</body></html>"

    include Erector::Mixin
    erector { div "love", :class => "big" }
    => "<div class=\"big\">love</div>"


The gem depends on rake and treetop, although this is just for using the command-line tool, so deployed applications won't need these. The Rails-dependent code is now separated so you can use Erector cleanly in a non-Rails app.


To install as a gem:

  • sudo gem install erector

Then add "require 'erector'" to any files which need erector.

To install as a Rails plugin:

  • Copy the erector source to vendor/plugins/erector in your Rails directory.

When installing this way, erector is automatically available to your Rails code (no require directive is needed).


Three spec rake tasks are provided: spec:core (core functionality), spec:erect (the erector command line tool), and spec:rails (rails integration).

rake spec will run the complete set of specs.


  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

See web site docs for more details.


Core Team:

  • Alex Chaffee
  • Jim Kingdon

Special Thanks To:

  • Abby (Chaffee's muse & Best friend)
  • Brian Takita
  • Jeff Dean
  • John Firebaugh
  • Nathan Sobo
  • Nick Kallen
  • Alon Salant
  • Andy Peterson


see History.txt


see LICENSE.txt


The fortitude gem is similar. Pick that one if you want better integration with tilt (the template rendering mechanism used in Sinatra and many other ruby web frameworks).

Something went wrong with that request. Please try again.