No commit activity in last 3 years
No release in over 3 years
Liquid extensions for Rails framework
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 4.0.0.rc2
>= 3.2
 Project Readme

Installation

Gemfile

gem 'liquid-rails-extensions', '~> 0.0.4'

config/initializers/liquid_template_handler.rb

require 'liquid'
require 'liquid4-rails'
require 'liquid-rails-extensions'

Usage

Path filter - provides relative path

# It will render /
{{ 'root'|path }}

# It will render /my-path/foo/bar
{{ 'my_route'|path: 'foo', 'bar' }}

Url filter - provides absolute path.

# It will render http://mydomain.com/
{{ 'root'|url }}

# It will render http://mydomain.com/my-path/foo/bar
{{ 'my_route'|url: 'foo', 'bar' }}

JSON filter - to parse a JSON string

{% assign object = '{"foo": "bar"}'|json_parse %}
# It will render 'bar'
{{ object.foo }}

ERB block - execute and render ERB code

{% erb %}
    <% if true %>
        <p>It's works.</p>
    <% end %>
{% enderb %}

More things

This gem is an extension of Liquid-Rails. It's depends on 'liquid4-rails', '~> 0.2.0'.