slim语法简单来说就是一种html模板,新的写法格式,可以配合后端ruby语言,一般适用于前后端交叉开发的环境下:
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 what a basic Slim file looks like.
== yield
- unless items.empty?
table
- items.each do |item|
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}