What is easiest way to debug variables in nodes,views,blocks and page
template.
Using Devel Kint, which comes with the Devel module.
Welcome to Kint 101
Important: in order to use kint() in a twig file you need to enable debuging for twig.
You enable Twig Debugging in sites/default/services.yml
. (If
services.yml
does not yet exist; copy default.services.yml
and
copy it to services.yml
.)
Set the debug variable to true. And clear cache.
parameters:
twig.config:
debug: true
Remember to turn debug back to false after you're done developing.
Source Debugging Twig templates
Now do the following to prevent issues
For starters, you are likely to run into this issue when you try a kint dump, specially if you just try {{ kint() }}
without passing any parameters

This is due to the array or object being too big for your server resources to handle the default kint settings.
Edit /modules/devel/kint/kint/config.default.php and set $_kintSettings['maxLevels']
to a lower number to reduce recursion and the memory needed for dumping variables. The default is 7, I have mine set to 4. If 4 still doesn't work for you, keep lowering the number.
Ok, lets use kint
Note: If you're trying to dbug when logged out, you'll need to give Access kint information permission to the anonymous user role.
For Example, in comments.html.twig we do a {{ kint(content) }}
and you will see

Tip #1 Do not click the + button, it's pure Evil
The + button will automatically open every single children and their children.
Instead, click on anywhere on the bar but the + button, for example, click here

Look how nice a tidy our Kint is

Also what is the easiest way to get protected variables values.
Getting a value
Lets say we're interested in the User. So click on user, but again do not click on the + button. You will see this

The id is protected, how do we get this value?
Tip #2 click on the available methods tab
This will reveal all methods that we can use here

So simply go with the one that makes most since, here being id()
to get the user id.
{{ content.user.id() }}
why debugging became so complex in drupal 8?
It's not, as long as you know how to use Kint
Using all the above tips and tricks, I was able to answer this question Show comment author e-mail in comment.html.twig