Global notes about Drupal development
Default settings file
Include local configuration file
/**
* If there is a local settings file, then include it
*/
$local_settings = __DIR__ . "/settings.local.php";
if (file_exists($local_settings)) {
include $local_settings;
}
Create a file local settings file
touch sites/default/settings.local.php
Settings for disable caches at settings.local.php
file
/**
* Enable php errors
*/
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
/**
* Link to local services
*/
$settings['container_yamls'][] = __DIR__ . '/local.services.yml';
/**
* Set error level
*/
$settings['error_level'] = 2;
/**
* Show all level errors
*/
$config['system.logging']['error_level'] = 'verbose';
/**
* Disable CSS/JS aggreation
*/
$config['system.performance']['css']['preprocess'] = FALSE;
$config['system.performance']['js']['preprocess'] = FALSE;
/**
* Disable the render cache and the dynamic page cache
*/
$settings['cache']['bins']['render'] = 'cache.backend.null';
$settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.null';
/**
* Allow test modules and themes to be installed if needed
*/
$settings['extension_discovery_scan_tests'] = TRUE;
Create Local settings file
touch sites/default/local.services.yml
Settings to debug twig at local.services.yml
# Required to disable cache
services:
cache.backend.null:
class: Drupal\Core\Cache\NullBackendFactory
# Enable Twig debugging
parameters:
twig.config:
# Twig debugging:
#
# When debugging is enabled:
# - The markup of each Twig template is surrounded by HTML comments that
# contain theming information, such as template file name suggestions.
# - Note that this debugging markup will cause automated tests that directly
# check rendered HTML to fail. When running automated tests, 'debug'
# should be set to FALSE.
# - The dump() function can be used in Twig templates to output information
# about template variables.
# - Twig templates are automatically recompiled whenever the source code
# changes (see auto_reload below).
#
# For more information about debugging Twig templates, see
# https://www.drupal.org/node/1906392.
#
# Not recommended in production environments
# @default false
debug: true
# Twig auto-reload:
#
# Automatically recompile Twig templates whenever the source code changes.
# If you don't provide a value for auto_reload, it will be determined
# based on the value of debug.
#
# Not recommended in production environments
# @default null
auto_reload: true
# Twig cache:
#
# By default, Twig templates will be compiled and stored in the filesystem
# to increase performance. Disabling the Twig cache will recompile the
# templates from source each time they are used. In most cases the
# auto_reload setting above should be enabled rather than disabling the
# Twig cache.
#
# Not recommended in production environments
# @default true
cache: false
# Download Module
drush pm-download stage_file_proxy
# Enable
drush pm-enable --yes stage_file_proxy
# Set file origin point to stage server
drush variable-set stage_file_proxy_origin "http://www.example.com"