kylekatarnls / jade-phalcon
Phalcon 的类似 HAML 模板引擎
资助包维护!
kylekatarnls
Open Collective
Tidelift
Requires
- php: >=5.3.0
- pug-php/pug: ^1.11
Replaces
- kylekatarnls/jade-phalcon: 1.0.0
README
此仓库现在位于 https://github.com/pug-php/pug-phalcon
pug-phalcon
Phalcon 的 Pug 模板引擎
要在您的 Phalcon 应用程序中使用 Pug,只需在 composer.json 的 require 部分添加以下内容
"pug-php/pug-phalcon": "^1.0"
或者使用命令行
composer require pug-php/pug-phalcon
然后注册模板
require '../vendor/autoload.php'; // ... $di = new FactoryDefault(); // Setting up the view component $di['view'] = function() { $view = new View(); $view->setViewsDir('../app/views/'); $view->registerEngines(array( ".pug" => function($view, $di) { return new \Phalcon\Mvc\View\Engine\Pug($view, $di, array( 'cache' => '/tmp/myproject/pug', 'prettyprint' => APP_ENV == 'development', )); } )); return $view; };
现在您可以在 views 目录中添加 pug 文件
app/views/index.pug
doctype html html head title pug-phalcon body p Generetad with pug-phalcon