One thing that helps immensely is to enable Twig debugging in your services.yml (not recommended for production environment).
parameters:
twig.config:
debug: true
auto_reload: true
cache: false
The auto_reload and cache settings can also be set to their development settings so you do not need to rebuild cache (remove compiled twig templates manually).
This will enable HTML comments that show what template is being used for various components in markup. Bartik and Classy, by default, displays this as block.html.twig
. The template suggestions for a block is block--PLUGINID.html.twig
where the PLUGINID is the the block's plugin id with underscores replaced by dashes.
Example debug output from my local development environment using a sub-theme of Classy:
<!-- THEME DEBUG -->
<!-- THEME HOOK: 'block' -->
<!-- FILE NAME SUGGESTIONS:
* block--userlogin.html.twig
x block--user-login-block.html.twig
* block--user.html.twig
* block.html.twig
-->
<!-- BEGIN OUTPUT from 'themes/custom/blah8/templates/block--user-login-block.html.twig' -->
<div id="block-userlogin" class="contextual-region block block-user block-user-login-block" role="form">