鈍足ランナーのIT日記

走るのが好きな5流のITエンジニアのブログ。

趣味の範囲は広いけど、どれも中途半端なクソブロガー楽しめるWebアプリを作ってあっと言わせたい。サーバーサイドPerl(Mojolicious)、クライアントサイドVue.js。Arduinoにも触手を伸ばす予定。

Mojoliciousのlayoutヘルパーで指定したlayoutのheadの中身を可変にしたい

exapmle/root.html.ep

% layout 'hoge',head=> 'boo';
<p>hello world</p>

layouts/hoge.html.ep

<html>
<head>
  <title>dokechin site</title>
  <%= include $head %>
</head>
<body>
  <%= content %> 
</body>
</html>

boo.html.ep

<script>
  function init(){}
</script>

headをカスタマイズしたくないときにも、何かしら値を入れないといけなくて、 きれいでないな。。いい方法ないでしょうか?

exapmle/index.html.ep

% layout 'hoge',head=> 'none';

none.html.ep

<!-- -->