pug-php / pug-symfony

Pug (Jade) template engine for Symfony

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incomplete installation on Symfony 4

gwenl opened this issue · comments

commented

Hello,

When installed on a Symfony 4 project, the installation script (v 2.4) will end with the following warnings:

Would you like us to add automatically needed settings in your config.yml? [Y/N] y
Would you like us to add automatically the pug bundle in your AppKernel.php? [Y/N] y
framework entry not found in config.yml.
Sorry, AppKernel.php has a format we can't handle automatically.

What should I do to to make the changes that could not be done automatically ?
I tried to add the following line to /config/bundles.php:

Pug\PugSymfonyBundle\PugSymfonyBundle::class => ['all' => true]

but this won't work: the bundle does not seem to be registered, since the "assets:publish" doesn't show in the list of available CLI commands.

commented

Hello,

Basically the automated config add the following to config.yml if present (in the services section):

    templating.engine.pug:
        public: true
        class: Pug\PugSymfonyEngine
        arguments: ["@kernel"]

You may use some other config system (XML) and so you must report the equivalent settings.

Then in AppKernel.php (for this one I cannot explain it's missing), you should add the following bundle: new Pug\PugSymfonyBundle\PugSymfonyBundle() in the list (the one that contains new Symfony\Bundle\FrameworkBundle\FrameworkBundle()).

commented

There is no longer a AppKernel.php file in Symfony 4, that's why I tried to register the bundle in bundles.php, as described here.

Also, the config.yml is absent by default but reporting the configuration in services.yaml does not work either.

I guess I'm doing something wrong but I can't put my finger on it.

commented

Our tests run on Symfony 4.0: https://travis-ci.org/pug-php/pug-symfony, it was the very begenning of Symfony 4.0 when I tested it in a real app but it was using config.yml. What exact version do you use? 4.0, 4.1 or 4.2?

commented

My project runs on version 4.1.

I just made a few tests on a blank symfony 4.0 project (initialized with composer create-project symfony/website-skeleton project 4.0.0), added the templating.engine.pug in services.yaml and Pug\PugSymfonyBundle\PugSymfonyBundle::class => ['all' => true] in config/bundles.php (as there's no AppKernel.php to be found)

  • the service is registered (appears in the list given by php bin/console debug:container)
  • still there is no assets:publish command available from the php bin/console list of commands
commented

Hi, I succeed to make it work with a new Symfony 4.1 project. It needs some adjustments in the project. I will update it and provide some tools to update automatically config for Symfony 4+ too and ensure it do not break older versions.

commented

Thank you very much!

commented

Patch 2.4.4 released, please re-try to install it using it, it should auto-install it modifying config/services.yaml, config/packages/framework.yaml and config/bundles.php

Now I should also update the README so I keep this issue open for now.

commented

New documentation added.

commented

Hello, sorry to come back to you about that, but I've tried versions 2.4.4 and 2.5.0, and the command "assets:publish" is still not available from the command line.
I checked on fresh installations of Symfony 4.0 and 4.1 with no luck, although the automatic configuration of YAML config files at installation time works fine now.

I wonder if this might help ? It has to do with "magic" discovery of commands that was removed in Symfony 4.0.