Skip to content

Instantly share code, notes, and snippets.

@tstone
Created September 13, 2012 22:41
Show Gist options
  • Save tstone/3718253 to your computer and use it in GitHub Desktop.
Save tstone/3718253 to your computer and use it in GitHub Desktop.
Template Comparison
#
# Slim Using Longhand (full tags)
# slim-lang.org
#
<!DOCTYPE html>
<html>
<head>
<title>Slim Examples</title>
<meta name="keywords" content="template language" />
<meta name="author" content="author" />
<script>
alert('Slim supports embedded javascript!');
</script>
</head>
<body>
<h1>Markup examples</h1>
<div id="content">
<p>This example shows you how a basic Slim file looks like.</p>
</div>
== yield
- unless items.empty?
<table>
- for item in items do
<tr><td class="name">#{item.name}</td><td class="price">#{item.price}</td></tr>
</table>
- else
<p>No items found. Please add some inventory. Thank you!</p>
<div id="footer">
= render 'footer'
| Copyright © #{year} #{author}
</div>
</body>
</html>
#
# Slim Using Shorthand
# slim-lang.org
#
doctype html
html
head
title Slim Examples
meta name="keywords" content="template language"
meta name="author" content=author
javascript:
alert('Slim supports embedded javascript!')
body
h1 Markup examples
#content
p This example shows you how a basic Slim file looks like.
== yield
- unless items.empty?
table
- for item in items do
tr
td.name = item.name
td.price = item.price
- else
p
| No items found. Please add some inventory.
Thank you!
div id="footer"
= render 'footer'
| Copyright © #{year} #{author}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment