kylekatarnls/jade-phalcon

This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.
This package is abandoned and no longer maintained. No replacement package was suggested.

HAML-like template engine for phalcon

1.0.0 2016-06-23 15:55 UTC

This package is auto-updated.

Last update: 2020-04-06 09:10:56 UTC


README

This repository now lives on https://github.com/pug-php/pug-phalcon

pug-phalcon

Pug Template Engine for Phalcon

To use Pug with your Phalcon application, just add to composer.json, in the require section:

"pug-php/pug-phalcon": "^1.0"

Or use the command line:

composer require pug-php/pug-phalcon

Then register the template:

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;
};

Now you can add pug files in the views directory:

app/views/index.pug:

doctype html
html
  head
    title pug-phalcon
  body
    p Generetad with pug-phalcon