2017 © Pedro Peláez
 

library pug-symfony

Pug template engine for Symfony

image

orbis-labs/pug-symfony

Pug template engine for Symfony

  • Monday, July 3, 2017
  • by aecca
  • Repository
  • 1 Watchers
  • 0 Stars
  • 66 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 21 Versions
  • 0 % Grown

The README.md

Pug-Symfony

Latest Stable Version Build Status StyleCI Code Climate, (*1)

Pug template engine for Symfony, (*2)

Install

In the root directory of your Symfony project, open a terminal and enter:, (*3)

composer require orbis-labs/pug-symfony

Add in app/config/services.yml:, (*4)

services:
    templating.engine.pug:
        class: PugBundle\PugTemplateEngine
        arguments: ["@kernel"]

Add jade in the templating.engines setting in app/config/config.yml:, (*5)

...
    templating:
        engines: ['pug', 'twig', 'php']

Configure

You can set pug options by accessing the container (from controller or from the kernel) in Symfony., (*6)

$services = $kernel->getContainer();
$pug = $services->get('templating.engine.pug');
$pug->setOptions(array(
  'pretty' => true,
  'pugjs' => true,
  // ...
));
// You can get the Pug engine to call any method available in pug-php
$pug->getEngine()->share('globalVar', 'foo');
$pug->getEngine()->addKeyword('customKeyword', $bar);

See the options in the pug-php README: https://github.com/pug-php/pug And methods directly available on the service: https://github.com/pug-php/pug-symfony/blob/master/src/Jade/JadeSymfonyEngine.php, (*7)

Usage

Create jade views by creating files with .pug extension in app/Resources/views such as contact.html.pug with some Jade like this:, (*8)

h1
  | Hello
  =name

Then call it in your controller:, (*9)

/**
 * @Route("/contact")
 */
public function contactAction()
{
    return $this->render('contact/contact.html.pug', [
        'name' => 'Bob',
    ]);
}

Deployment

In production, you better have to pre-render all your templates to improve performances. To do that, you have to add Pug\PugSymfonyBundle\PugSymfonyBundle in your registered bundles., (*10)

In app/AppKernel.php, in the registerBundles() method, add the Pug bundle:, (*11)

public function registerBundles()
{
    $bundles = [
        ...
        new PugBundle\PugBundle(),
    ];

This will make the assets:publish command available, now each time you deploy your app, enter the command below: php bin/console assets:publish --env=prod, (*12)

The Versions

03/07 2017

dev-master

9999999-dev

Pug template engine for Symfony

  Sources   Download

MIT

The Requires

 

The Development Requires

by Andy Ecca

03/07 2017

2.2.3

2.2.3.0

Pug template engine for Symfony

  Sources   Download

MIT

The Requires

 

The Development Requires

by Andy Ecca

04/05 2017

2.2.2

2.2.2.0

Pug template engine for Symfony

  Sources   Download

MIT

The Requires

 

The Development Requires

04/05 2017

dev-fix-issue-11

dev-fix-issue-11

Pug template engine for Symfony

  Sources   Download

MIT

The Requires

 

The Development Requires

09/01 2017

dev-906c5a8

dev-906c5a8

Pug template engine for Symfony

  Sources   Download

MIT

The Requires

 

The Development Requires

09/01 2017

dev-css-helper

dev-css-helper

Pug template engine for Symfony

  Sources   Download

MIT

The Requires

 

The Development Requires

03/01 2017

2.2.1

2.2.1.0

Pug template engine for Symfony

  Sources   Download

MIT

The Requires

 

The Development Requires

02/01 2017

dev-analysis-8P33GA

dev-analysis-8P33GA

Pug template engine for Symfony

  Sources   Download

MIT

The Requires

 

The Development Requires

04/08 2016

2.1.5

2.1.5.0

Pug template engine for Symfony

  Sources   Download

MIT

The Requires

 

04/08 2016

2.1.4

2.1.4.0

Pug template engine for Symfony

  Sources   Download

MIT

The Requires

 

04/08 2016

2.1.3

2.1.3.0

Pug template engine for Symfony

  Sources   Download

MIT

The Requires

 

02/08 2016

2.1.2

2.1.2.0

Pug template engine for Symfony

  Sources   Download

MIT

The Requires

 

02/08 2016

2.1.1

2.1.1.0

Pug template engine for Symfony

  Sources   Download

MIT

The Requires

 

02/08 2016

2.1.0

2.1.0.0

Pug template engine for Symfony

  Sources   Download

MIT

The Requires

 

29/07 2016

2.0.1

2.0.1.0

Pug template engine for Symfony

  Sources   Download

MIT

The Requires

 

29/07 2016

2.0.0

2.0.0.0

Pug template engine for Symfony

  Sources   Download

MIT

The Requires

 

27/07 2016

1.3.3

1.3.3.0

Pug template engine for Symfony

  Sources   Download

MIT

The Requires

 

30/06 2016

1.3.2

1.3.2.0

Pug template engine for Symfony

  Sources   Download

MIT

The Requires

 

30/06 2016

1.3.1

1.3.1.0

Pug template engine for Symfony

  Sources   Download

MIT

The Requires

 

23/06 2016

1.3.0

1.3.0.0

Pug template engine for Symfony

  Sources   Download

MIT

The Requires