drupal-dev-mode v1.0.5
drupal-dev-mode package
This is an attempt to be able to quickly toggle on/off Drupal 8's 'dev mode', with one command.
The command/scripts here were written to run in the context of a Drupal site running in a local Lando/Docker setup (see "Prerequisites" section below).
'dev mode' consists of:
- enabling inclusion of a
settings.local.phpfile into the (default) Drupal site'ssettings.phpfile (again, see "Prerequisites" below) - enabling Twig debugging in
development.services.yml(which is enabled by inclusion ofsettings.local.phpinsettings.php) - enabling inclusion of Drupal cache related settings (
render,pageanddynamic_page_cache) to nullify caches insettings.local.php
This package provides a CLI command, toggle-dev-mode that
achieves the points listed above. Running the command once will toggle 'dev
mode' on. Running it a second time will toggle 'dev mode' off again.
Prerequisites
You will have a Drupal 8 site running locally via Lando. The Drupal install dir will be
docroot,webordrupal.You will need to have already created
settings.local.php(from the out of the box example) and moved to thedefaultsite directory. This package does not (yet) attempt to create that file, only modify it.This package should be installed in a
node_modulesfolder that is a sibling of the Drupal install (Eg. a sibling ofdocroot,webordrupal).This should just be
npm install drupal-dev-mode.The package assumes this location when trying to find the various files to modify when running
toggle-dev-mode.
Running the toggle-dev-mode command/script
This should just be as simple as:
npx toggle-dev-modeYou can also run the script directly with:
node node_modules/drupal-dev-mode/cli.jsOutput from running the command should be similar to:
~/W/xxx> npx toggle-dev-mode
Uncommenting $settings['cache']['bins']['render']
Uncommenting $settings['cache']['bins']['page']
Uncommenting $settings['cache']['bins']['dynamic_page_cache']
Updated /Users/alex/Work/xxx/docroot/sites/development.services.yml!
Updated /Users/alex/Work/xxx/docroot/sites/default/settings.local.php!
Updated /Users/alex/Work/xxx/docroot/sites/default/settings.php! (Enable settings.local.php inclusion)You will still want to run a drush cache:rebuild (or drush cr) after
running, to ensure changes take effect.