opulent

Ruby Template Engine for Creative Web Developers

8
0
Ruby

Opulent

Build Status

Opulent is a templating engine which strives to make page markup as beautiful and expressive as it should be. It’s blazing fast, offers useful reusable component definitions and encourages well organised front end code. Opulent provides the cleanliness, readability and development speed you need for your project.

Syntax

Opulent has a beautiful, minimalistic syntax: no tags, indentation based, optional brackets, inline text, inline children and in page definitions.

Page Markup

html
  head
    title Opulent is Awesome
  body
    #content
      ul.list-inline
        li > a href="http://opulent.io" Opulent
        li > a href="http://github.com" GitHub

    footer |
      With Opulent, you can do anything.

Reusable Component

def hello(place)
  p Hello #{place}
  
hello place="World"
def content
  #content
    yield
  
content 
  h1 I'll replace yield!

Control Structures

ul.navbar
  if @user.logged_in?
    li Hello #{@user.name}
  else
    li > a href=link_to_register Sign Up

Elegant

Markup should beautiful and clean. Opulent makes markup a pleasant experience.

Reusable

Completely DRY, in opulent you can define reusable markup elements easily.

Full Featured

Everything you need, right from the start. Ready for all the major Ruby frameworks.

Performant

Opulent is lightweight, blazing fast. Performance is measured with every release.

Like it? There’s so much more you can do with Opulent.

Read the Documentation

Installation

Install it yourself using the ruby gem:

$ gem install opulent

Or add this line to your application’s Gemfile:

gem 'opulent'

And then execute:

$ bundle

Usage

Using Opulent to render a file is as easy as including it in your application and using the render method.

Read the Documentation

require 'opulent'

engine = Opulent.new(:index)
output = engine.render

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/opulent/opulent. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

Production Ready

Opulent is production ready and has serious potential to becoming the next generation of Templating Engines for Ruby, therefore any contribution is more than welcome.

License

The gem is available as open source under the terms of the MIT License.