Ruby Template Engine for Creative Web Developers
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.
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
Markup should beautiful and clean. Opulent makes markup a pleasant experience.
Completely DRY, in opulent you can define reusable markup elements easily.
Everything you need, right from the start. Ready for all the major Ruby frameworks.
Opulent is lightweight, blazing fast. Performance is measured with every release.
Like it? There’s so much more you can do with Opulent.
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
Using Opulent to render a file is as easy as including it in your application and using the render method.
require 'opulent'
engine = Opulent.new(:index)
output = engine.render
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.
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.
The gem is available as open source under the terms of the MIT License.