Code Monkey home page Code Monkey logo

erector's Introduction

Erector

DESCRIPTION

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 http://erector.github.io/erector for more documentation.

No, seriously, we've got hella docs at http://erector.github.io/erector -- go check it out.

SYNOPSIS

    require 'erector'

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

    Hello.new(:target => '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>"

REQUIREMENTS

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.

INSTALL

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).

TESTS

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.

CONTRIBUTING

  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.

CREDITS

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

VERSION HISTORY

see History.txt

LICENSE: MIT

see LICENSE.txt

SEE ALSO

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).

erector's People

Contributors

alexch avatar jkingdon avatar btakita avatar ndp avatar ageweke avatar zelig avatar zilkey avatar aeon avatar needfeed avatar ahto avatar thewoolleyman avatar dsander avatar nestegg avatar jasonbarnabe avatar mikelewis avatar nakajima avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.