symfony / recipes-contrib

Symfony Contrib Recipes Repositories

Home Page:https://github.com/symfony/recipes-contrib/blob/flex/main/RECIPES.md

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Assetic default parameters in framework

shakaran opened this issue · comments

Using symfony flex and symfony 4.x creation project doc:

composer create-project symfony/skeleton admin-theme-test
Installing symfony/skeleton (v3.3.2)
  - Installing symfony/skeleton (v3.3.2) Loading from cache
Created project in admin-theme-test
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 23 installs, 0 updates, 0 removals
  - Installing symfony/flex (v1.0.20) Loading from cache
  - Installing symfony/stopwatch (v3.3.9) Loading from cache
  - Installing symfony/routing (v3.3.9) Loading from cache
  - Installing symfony/polyfill-mbstring (v1.5.0) Loading from cache
  - Installing symfony/http-foundation (v3.3.9) Loading from cache
  - Installing symfony/event-dispatcher (v3.3.9) Loading from cache
  - Installing psr/log (1.0.2) Loading from cache
  - Installing symfony/debug (v3.3.9) Loading from cache
  - Installing symfony/http-kernel (v3.3.9) Loading from cache
  - Installing symfony/finder (v3.3.9) Loading from cache
  - Installing symfony/filesystem (v3.3.9) Loading from cache
  - Installing psr/container (1.0.0) Loading from cache
  - Installing symfony/dependency-injection (v3.3.9) Loading from cache
  - Installing symfony/config (v3.3.9) Loading from cache
  - Installing symfony/class-loader (v3.3.9) Loading from cache
  - Installing symfony/polyfill-apcu (v1.5.0) Loading from cache
  - Installing psr/simple-cache (1.0.0) Loading from cache
  - Installing psr/cache (1.0.1) Loading from cache
  - Installing symfony/cache (v3.3.9) Loading from cache
  - Installing doctrine/cache (v1.7.1) Loading from cache
  - Installing symfony/framework-bundle (v3.3.9) Loading from cache
  - Installing symfony/yaml (v3.3.9) Loading from cache
  - Installing symfony/dotenv (v3.3.9) Loading from cache
Writing lock file
Generating autoload files
Symfony operations: 3 recipes
  - Configuring symfony/flex (1.0): From github.com/symfony/recipes:master
  - Configuring symfony/routing (3.3): From github.com/symfony/recipes:master
  - Configuring symfony/framework-bundle (3.3): From github.com/symfony/recipes:master
Executing script make cache-warmup [OK]
Skipping "assets:install --symlink --relative public" (needs symfony/console to run).

              
 What's next? 
              

  * Run your application:
    1. Change to the project directory
    2. Execute the make serve command;
    3. Browse to the http://localhost:8000/ URL.

  * Read the documentation at https://symfony.com/doc

Note the warning about assets not generated because symfony/console is not included

After install the console:

$ composer req console
Using version ^3.3 for symfony/console
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing symfony/console (v3.3.9) Loading from cache
Writing lock file
Generating autoload files
Symfony operations: 1 recipe
  - Configuring symfony/console (3.3): From github.com/symfony/recipes:master
Executing script make cache-warmup [OK]
Executing script assets:install --symlink --relative public [OK]

After that trying to install assetic:

$ composer req symfony/assetic-bundle
Using version ^2.8 for symfony/assetic-bundle
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 3 installs, 0 updates, 0 removals
  - Installing symfony/process (v3.3.9) Loading from cache
  - Installing kriswallsmith/assetic (v1.4.0) Loading from cache
  - Installing symfony/assetic-bundle (v2.8.2) Loading from cache
Writing lock file
Generating autoload files
Symfony operations: 1 recipe
  - Configuring symfony/assetic-bundle (v2.8.2): From auto-generated recipe
Executing script make cache-warmup [KO]
 [KO]
Script make cache-warmup returned with error code 2
!!  
!!  
!!                                                                                  
!!    [Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException]  
!!  
!!    You have requested a non-existent parameter "templating.engines".             
!!  
!!                                                                                  
!!  
!!  
!!  Makefile:15: recipe for target 'cache-clear' failed
!!  
!!  make: *** [cache-clear] Error 1
!!  
!!  

Installation failed, reverting ./composer.json to its original content.

This is because in config/packages/framework.yaml is missing:

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

And it is not automatically updated or added when you install assetic

This is missing on purpose. As of Symfony 3.3, we do not recommend using the templating layer, but Twig only. So, this is something that must be fixed in Assetic instead. In the meantime, you can add the mentioned configuration to make it happy.