Configure your development environment for Theming
One of the first things that I do when I start a new project is to configure my environment as development, to react on what I'm doing, specially when I'm theming. Disable cache, enable debug messages and more. These steps are among the ones that I always do:
Setting up my settings.local.php file
Go to the sites/ folder of your project and copy example.settings.local.php to the folder like this: cp example.settings.local.php default/settings.local.php
(renaming it to settings.local.php in the process).
Open the file and locate this line: # $settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.null';
Uncomment it (by removing the #). This will disable caching on your local development machine.
Open development.services.yml file and add these lines (be careful about indentations!):
parameters:
twig.config:
debug: true
auto-reload: true
cache: false
More configuration can be found in default.services.yml file. But don't edit that file, that won't work. Actually, in settings.php, the file services.yml is loaded (it doesn't exists, but it tries to load it), but by renaming default.services.yml into services.yml you are making global changes instead of development changes, and that's not a good practice. You always want to keep your development settings aside.
If everything is working correctly, you should have a lot of comments in your source (view source).
Add new comment