mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-28 22:55:12 -07:00
Updated Home (textile)
+18
@@ -5,6 +5,24 @@ Liquid is a template engine which was crafted for very specific requirements
|
|||||||
* It has to be stateless. The compile and render steps have to be separate, so that the expensive parsing and compiling can be done once; later on, you can just render it by passing in a hash with local variables and objects.
|
* It has to be stateless. The compile and render steps have to be separate, so that the expensive parsing and compiling can be done once; later on, you can just render it by passing in a hash with local variables and objects.
|
||||||
* It needs to be able to style emails as well as HTML.
|
* It needs to be able to style emails as well as HTML.
|
||||||
|
|
||||||
|
h2. What does it look like?
|
||||||
|
|
||||||
|
source = %|
|
||||||
|
<ul id="products">
|
||||||
|
{% for product in products %}
|
||||||
|
<li>
|
||||||
|
<h2>{{product.name}}</h2>
|
||||||
|
Only {{product.price | price }}
|
||||||
|
|
||||||
|
{{product.description | textile }}
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>|
|
||||||
|
|
||||||
|
@template = Liquid::Template.parse(source)
|
||||||
|
@template.render( 'products' => Product.all )
|
||||||
|
|
||||||
|
|
||||||
h2. Stuff to read, watch, etc.
|
h2. Stuff to read, watch, etc.
|
||||||
|
|
||||||
* [[Liquid for Programmers]]
|
* [[Liquid for Programmers]]
|
||||||
|
|||||||
Reference in New Issue
Block a user