Skip to content

Instantly share code, notes, and snippets.

@renebakx
Last active January 23, 2018 09:22
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save renebakx/ccf17e65e5d9c9daeaae to your computer and use it in GitHub Desktop.
Save renebakx/ccf17e65e5d9c9daeaae to your computer and use it in GitHub Desktop.
No more drush cr for Drupal 8 theme development

this bit goes in development.services.yml

services:
  cache.backend.null:
    class: Drupal\Core\Cache\NullBackendFactory
parameters:
  twig.config:
    debug: true
    auto_reload: null
    cache: false

please do note that turning off the cache causes twig to compile every template needed for your view on every hit. This can be slowly, turn it back on if you do not need be 100% sure the compiled template is really fresh

this bit goes in development.settings.php

<?php
$settings['container_yamls'][] = DRUPAL_ROOT . '/sites/development.services.yml';
// disable render cache
$settings['cache']['bins']['render'] = 'cache.backend.null';
$settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.null';

And finally add this at the end of your settings.local.php or settings.php

$development_config = DRUPAL_ROOT . '/sites/development.settings.php';
if (file_exists($development_config)){
  require_once $development_config;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment