Jubako gives multi-level layout inheritance in Rails view, like Jade's template inheritance.
Add this line to your Rails application's Gemfile:
gem 'jubako'
And then execute:
$ bundle
Or install it yourself as:
$ gem install jubako
These usage are using Slim.
Jubako defines extends
method in view helper. When you call extends
with layout path (in anywhere of view), it will render with using specified layout.
Have you specified any layout before rendering? It applies after Jubako inheritances.
- extends 'layouts/base_template'
- block :body
h1 Top#index
p Find me in app/views/top/index.slim
- block :title
title Base template's title
= block :body
doctype html
html
head
= block :title
body
= yield
<!DOCTYPE html>
<html>
<head>
<title>Base template's title</title>
</head>
<body>
<h1>
Top#index
</h1>
<p>
Find me in app/views/top/index.slim
</p>
</body>
</html>
Jubako is under developing by Yuki Hattori.
Bug reports and pull requests are welcome on GitHub at https://github.com/yhatt/jubako.
The gem is available as open source under the terms of the MIT License.