sielay / jadebundle
封装 relo-san/EverzetJadeBundle 的 EverzetJadeBundle
dev-master
2014-07-26 21:28 UTC
Requires
- php: >=5.3.0
- pagon/jade: *
This package is not auto-updated.
Last update: 2024-09-24 02:37:11 UTC
README
为您的 Symfony2 项目提供 Jade.php 模板支持。有关更多信息,请参阅 Jade.php 网站 & 仓库。
特性
- 高性能解析器
- 易读性高
- 编译和运行时上下文错误报告
- 结合动态和静态标签类
- 无标签前缀
- 清晰且美观的 HTML 输出
- 过滤器
- :php
- :cdata
- :css
- :javascript
- TextMate 扩展包
- VIM 插件
安装
将捆绑包添加到您的 composer
// composer.json
{
...
"sielay/jadebundle" : "dev-master"
}
更新您的 composer
//
composer update
将 EverzetJadeBundle 添加到您的应用程序内核
// app/AppKernel.php
public function registerBundles()
{
return array(
// ...
new Bundle\Everzet\JadeBundle\EverzetJadeBundle(),
// ...
);
}
在应用程序配置中开启 jade 捆绑包
# app/config/config.yml
jade.config: ~
编写模板
像编写 php 一样编写 jade 模板,但以 .jade
扩展名结尾
# Application/HelloBundle/Resources/views/Hello/index.jade
- $view->extend('HelloBundle::layout.jade')
h2
| Hello {{ $name }}!!!
# Application/HelloBundle/Resources/views/layout.jade
!!! strict
html
head
meta( http-equiv:"Content-Type", content="text/html; charset=utf-8" )
title
- $view['slots']->output('title', 'Hello Application')
body
h1 Hello Application
- $view['slots']->output('_content')
然后您可以像这样渲染它们
return $this->render('HelloBundle:Hello:index.jade', array('name' => $name));
致谢
贡献开发者的名单
- Konstantin Kudryashov (ever.zet@gmail.com)
- Lukasz Marek Sielski (lukaszsielski@gmail.com)