Enable Drupal 8 cache from settings.php file

Cache all the things!

When you are developing locally on a Drupal 8 website you don't want to have the cache enabled. But on your live site you do (or most of the times!).

Syncing configuration in Drupal 8 is great but you don't want to overwrite your cache settings on your live website. A solution is to force cache on your live environment by adding the following in your settings.php file:

$config['system.performance']['css']['preprocess'] = 1;
$config['system.performance']['css']['gzip'] = 1;
$config['system.performance']['js']['preprocess'] = 1;
$config['system.performance']['js']['gzip'] = 1;
$config['system.performance']['cache']['page']['max_age'] = 86400;

If you want to change more stuff between environments I recommend to take a look at the Config split contrib module.


Meer leesvoer

I have been working on a Drupal 8 multisite and at some point I had to set up a new site in the structure. The...
In this blog post you will learn how to add a theme field preprocess function in your theme.
In this blog post I show you how to login and logout from a Drupal 8 Back-end from an Ionic app
It's quite easy to create a node with REST in Drupal 8, in this blog post I'll show you how to do it.