symfony / recipes

Symfony Recipes Repository
https://github.com/symfony/recipes/blob/flex/main/RECIPES.md
MIT License
965 stars 476 forks source link

Add TwigBundle 6.4 with `file_name_pattern: *.twig` #1256

Closed GromNaN closed 8 months ago

GromNaN commented 10 months ago
Q A
License MIT
Doc issue/PR -

By default, Twig templates have the .twig extension. They can be collocated with other files (SVG, CSS, JS or even PHP for Twig Components)

Adding the option twig.file_name_pattern: '*.twig' by default for new projects is necessary to avoid compiling non-twig files.

Related to symfony/symfony#45845

github-actions[bot] commented 10 months ago

Thanks for the PR 😍

How to test these changes in your application

  1. Define the SYMFONY_ENDPOINT environment variable:

    # On Unix-like (BSD, Linux and macOS)
    export SYMFONY_ENDPOINT=https://raw.githubusercontent.com/symfony/recipes/flex/pull-1256/index.json
    # On Windows
    SET SYMFONY_ENDPOINT=https://raw.githubusercontent.com/symfony/recipes/flex/pull-1256/index.json
  2. Install the package(s) related to this recipe:

    composer req 'symfony/flex:^1.16'
    composer req 'symfony/twig-bundle:^6.4'
  3. Don't forget to unset the SYMFONY_ENDPOINT environment variable when done:

    # On Unix-like (BSD, Linux and macOS)
    unset SYMFONY_ENDPOINT
    # On Windows
    SET SYMFONY_ENDPOINT=

Diff between recipe versions

In order to help with the review stage, I'm in charge of computing the diff between the various versions of patched recipes. I'm going keep this comment up to date with any updates of the attached patch.

symfony/twig-bundle

3.3 vs 4.4 ```diff diff --git a/symfony/twig-bundle/3.3/config/packages/twig.yaml b/symfony/twig-bundle/4.4/config/packages/twig.yaml index d1582a2..6403e6a 100644 --- a/symfony/twig-bundle/3.3/config/packages/twig.yaml +++ b/symfony/twig-bundle/4.4/config/packages/twig.yaml @@ -2,3 +2,4 @@ twig: default_path: '%kernel.project_dir%/templates' debug: '%kernel.debug%' strict_variables: '%kernel.debug%' + exception_controller: null diff --git a/symfony/twig-bundle/3.3/config/routes/dev/twig.yaml b/symfony/twig-bundle/3.3/config/routes/dev/twig.yaml deleted file mode 100644 index f4ee839..0000000 --- a/symfony/twig-bundle/3.3/config/routes/dev/twig.yaml +++ /dev/null @@ -1,3 +0,0 @@ -_errors: - resource: '@TwigBundle/Resources/config/routing/errors.xml' - prefix: /_error ```
4.4 vs 5.0 ```diff diff --git a/symfony/twig-bundle/4.4/config/packages/twig.yaml b/symfony/twig-bundle/5.0/config/packages/twig.yaml index 6403e6a..b3cdf30 100644 --- a/symfony/twig-bundle/4.4/config/packages/twig.yaml +++ b/symfony/twig-bundle/5.0/config/packages/twig.yaml @@ -1,5 +1,2 @@ twig: default_path: '%kernel.project_dir%/templates' - debug: '%kernel.debug%' - strict_variables: '%kernel.debug%' - exception_controller: null ```
5.0 vs 5.3 ```diff diff --git a/symfony/twig-bundle/5.0/config/packages/test/twig.yaml b/symfony/twig-bundle/5.0/config/packages/test/twig.yaml deleted file mode 100644 index 8c6e0b4..0000000 --- a/symfony/twig-bundle/5.0/config/packages/test/twig.yaml +++ /dev/null @@ -1,2 +0,0 @@ -twig: - strict_variables: true diff --git a/symfony/twig-bundle/5.0/config/packages/twig.yaml b/symfony/twig-bundle/5.3/config/packages/twig.yaml index b3cdf30..f9f4cc5 100644 --- a/symfony/twig-bundle/5.0/config/packages/twig.yaml +++ b/symfony/twig-bundle/5.3/config/packages/twig.yaml @@ -1,2 +1,6 @@ twig: default_path: '%kernel.project_dir%/templates' + +when@test: + twig: + strict_variables: true diff --git a/symfony/twig-bundle/5.0/manifest.json b/symfony/twig-bundle/5.3/manifest.json index 30d5643..c4835ac 100644 --- a/symfony/twig-bundle/5.0/manifest.json +++ b/symfony/twig-bundle/5.3/manifest.json @@ -5,5 +5,8 @@ "copy-from-recipe": { "config/": "%CONFIG_DIR%/", "templates/": "templates/" + }, + "conflict": { + "symfony/framework-bundle": "<5.3" } } ```
5.3 vs 5.4 ```diff diff --git a/symfony/twig-bundle/5.3/templates/base.html.twig b/symfony/twig-bundle/5.4/templates/base.html.twig index 16d7273..d4f83f7 100644 --- a/symfony/twig-bundle/5.3/templates/base.html.twig +++ b/symfony/twig-bundle/5.4/templates/base.html.twig @@ -3,14 +3,14 @@ {% block title %}Welcome!{% endblock %} - {# Run `composer require symfony/webpack-encore-bundle` - and uncomment the following Encore helpers to start using Symfony UX #} + + {# Run `composer require symfony/webpack-encore-bundle` to start using Symfony UX #} {% block stylesheets %} - {#{{ encore_entry_link_tags('app') }}#} + {{ encore_entry_link_tags('app') }} {% endblock %} {% block javascripts %} - {#{{ encore_entry_script_tags('app') }}#} + {{ encore_entry_script_tags('app') }} {% endblock %} ```
5.4 vs 6.3 ```diff diff --git a/symfony/twig-bundle/5.4/templates/base.html.twig b/symfony/twig-bundle/6.3/templates/base.html.twig index d4f83f7..67598ac 100644 --- a/symfony/twig-bundle/5.4/templates/base.html.twig +++ b/symfony/twig-bundle/6.3/templates/base.html.twig @@ -4,13 +4,10 @@ {% block title %}Welcome!{% endblock %} - {# Run `composer require symfony/webpack-encore-bundle` to start using Symfony UX #} {% block stylesheets %} - {{ encore_entry_link_tags('app') }} {% endblock %} {% block javascripts %} - {{ encore_entry_script_tags('app') }} {% endblock %} ```
6.3 vs 6.4 ```diff diff --git a/symfony/twig-bundle/6.3/config/packages/twig.yaml b/symfony/twig-bundle/6.4/config/packages/twig.yaml index f9f4cc5..3f795d9 100644 --- a/symfony/twig-bundle/6.3/config/packages/twig.yaml +++ b/symfony/twig-bundle/6.4/config/packages/twig.yaml @@ -1,5 +1,5 @@ twig: - default_path: '%kernel.project_dir%/templates' + file_name_pattern: '*.twig' when@test: twig: diff --git a/symfony/twig-bundle/6.3/templates/base.html.twig b/symfony/twig-bundle/6.4/templates/base.html.twig index 67598ac..1069c14 100644 --- a/symfony/twig-bundle/6.3/templates/base.html.twig +++ b/symfony/twig-bundle/6.4/templates/base.html.twig @@ -3,7 +3,7 @@ {% block title %}Welcome!{% endblock %} - + {% block stylesheets %} {% endblock %} ```
OskarStark commented 10 months ago

Related to #45845

Is not clickable