Problem/Motivation

Theme debugging is slightly more cumbersome to enable for beginners than it used to be, there are three variables that need to be added to the services.yml file, without accidentally committing the changes and pushing them to production.

Drupal core ships with both a development.services.yml file for the purpose of enabling some development-mode settings for local development work, and a example.settings.local.php file (that can be cloned and renamed to "settings.local.php") to load that. However, even making those steps is not enough, the site builder must then still customize the development.services.yml file itself to add the n

Proposed resolution

Add the necessary settings in development.services.yml to enable theme debugging when that file is loaded.

Remaining tasks

TBD

User interface changes

TBD

API changes

TBD

Data model changes

TBD

Release notes snippet

TBD

Comments

DamienMcKenna created an issue. See original summary.

damienmckenna’s picture

Status: Active » Needs review
StatusFileSize
new463 bytes

This modifies the development.services.yml file as suggested.

damienmckenna’s picture

StatusFileSize
new1010 bytes
new547 bytes

This includes one patch for the core/assets/scaffold/files/development.services.yml file and another that covers both.

The last submitted patch, 2: drupal-n3272587-2.patch, failed testing. View results

Status: Needs review » Needs work

The last submitted patch, 3: drupal-n3272587-3.patch, failed testing. View results

damienmckenna’s picture

Status: Needs work » Needs review
damienmckenna’s picture

StatusFileSize
new1.22 KB
new666 bytes
new582 bytes

:facepalm:

It goes in the "parameters" section, not the "services" section.

The last submitted patch, 7: drupal-n3272587-7-justcoreassets.patch, failed testing. View results

Status: Needs review » Needs work

The last submitted patch, 7: drupal-n3272587-7-justsites.patch, failed testing. View results

andregp’s picture

Status: Needs work » Needs review

I believe it's needs review as per drupal-n3272587-7.patch at #7

damienmckenna’s picture

Unfortunately this doesn't actually work, having these lines in development.services.yml doesn't override what's defined in services.yml, which seems like a core bug.

jwilson3’s picture

Status: Needs review » Needs work
+++ b/core/assets/scaffold/files/development.services.yml
@@ -4,6 +4,13 @@
 parameters:
   http.response.debug_cacheability_headers: true
+  twig.config:
+    # Enable Twig debugging.
+    debug: false

Title says: "Enable theme debugging by default in development.services.yml".

Then shouldn't parameters.twig.config.debug be set to true instead of false? (Maybe this is why you thought you were seeing a bug where settings do not override those in services.yml (fwiw, ive never had a problem overriding services.yml).

+++ b/core/assets/scaffold/files/development.services.yml
@@ -4,6 +4,13 @@
+    # Enable Twig auto-reload.
+    auto_reload: true

My understanding of auto_reload is that it generally should always be left as null, because it knows what to do based on whatever value is set for the debug value.

see note at end of comment #2839709-25: Make Debugging Twig easier

Why this is a better approach than the one on #2839709: Make Debugging Twig easier. Do you have any thoughts?

damienmckenna’s picture

Status: Needs work » Needs review
StatusFileSize
new1.25 KB

*cleans his glasses*. This one turns on the "debug" mode. Thanks James.

I didn't know about #2839709 before I put this one together. My rationale for modifying this file was the simplicity of leveraging what's included in the codebase already rather than making the codebase more complicated by adding another file; the development.services.yml file is already intended to be used locally when the site is in development mode, which is when you'd want the theme debugging enabled.

jwilson3’s picture

Rationale makes sense, however, not all developers want theme debugging turned on by default, and my experience is that it can occasionally break site functionality, but it's an edge case, and adds some level of additional page generation overhead (how much, I'm not entirely sure).

Status: Needs review » Needs work

The last submitted patch, 13: drupal-n3272587-13.patch, failed testing. View results

damienmckenna’s picture

Status: Needs work » Closed (duplicate)

After thinking on it a bit, I'm going to close this and go with #2839709 as an extra opt-in option for sites to manage.