Liquid templates and RJS

Does anybody know whether Liquid templates can be combined with RJS ?

Liquid templates can in its rudimentary state be used within an RJS
template, but it really doesn’t make much sense, from that perspective.

The purpose of a Liquid template is to remove the ability to access Ruby
directly, but still providing adequate access to variables and being
able to
manipulate or loop through those data sets. So to use Liquid syntax
within
an RJS template really defeats the purpose of what its intention is as a
RJS
template implies the ability to use Ruby directly.

Now, from the other perspective on whether you can use the RJS
functionality
within a Liquid template is another story. How complicated when it gets
down
to it is up to you, but the concept is that it can be done by wrapping
all
the RJS methods (page.replace_html, page.remove, etc) with custom Liquid
template filters like so…

{{ ‘New title’ | replace_html: ‘elementId’ }}

To go even further, I suppose you could even use the configured
variables
supplied to the Liquid template within each expression like so:

{{ user.name | replace_html: ‘elementId’ }}

So it really depends on what your perspective is :slight_smile:

-Nb

 Nathaniel S. H. Brown                           http://nshb.net