Liquid Basics
Posted in Rails, Ruby, Ruby on Rails, liquid, ror on March 3rd, 2009 by admin – 1 CommentLiquid is a template engine extracted from the e-commerce system Shopify. Now t is a stand alone ruby library. Liquid can be used either in a Ruby application or in a Ruby On Rails application
Why Should We Use liquid ?
- Allow users to edit the appearance of your application.
- Easy and secure.
- Render templates directly from the database.
- Style HTML as well as emails.
- Extending Liquid is very easy
- Simple markups.
- If you like Smarty-style template engines
How to get it?
Liquid can be installed either as liquid gem or plugin.
Plugin can be installed simply with by script/install:
RubyGems
Liquid Basics
Liquid have two type of markups
- Output markup (which may resolve to text)
{{ matched pairs of curly brackets (ie, braces) }}
example
- Tag markup (which cannot resolve to text and are used for logic)
{% matched pairs of curly brackets and percent signs %}
example