Skip to content

Symfony 4 and 5 manual installation

Kyle edited this page Nov 28, 2019 · 1 revision

To use Pug as a template engine in Symfony 4 or 5, you need to follow those steps:

config/services.yaml

Add the templating.engine.pug service:

services:
    templating.engine.pug:
        public: true
        autowire: false
        class: Pug\PugSymfonyEngine
        arguments:
            - '@kernel'

config/packages/framework.yaml

Add pug in the engines setting:

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

config/bundles.php

In order to use pug cli commands, you will also need to add Pug\PugSymfonyBundle\PugSymfonyBundle to your config/bundles.php.

<?php

return [
    Pug\PugSymfonyBundle\PugSymfonyBundle::class => ['all' => true],
    // ... other bundles