Ruby編寫的模板語言:Slim Lang
Slim是一個Ruby編寫的模板語言,其目標是快速、輕量級、語法簡潔。它有著類似HAML的語法,使用縮進來表示嵌套關系,支持內嵌代碼和在Rails上使用(slim-rails)。下面是一個haml模板的例子:
doctype html html head title Slim Examples meta name="keywords" content="template language" meta name="author" content=author link rel="icon" type="image/png" href=file_path("favicon.png") javascript: alert('Slim supports embedded javascript!') body h1 Markup examples #content p This example shows you how a basic Slim file looks like. == yield - if items.any? table#items - for item in items 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}
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!