0

Basic caching settings all off:

enter image description here

settings.local.php is loaded:

enter image description here

Bottom of settings.php:

if (file_exists($app_root . '/' . $site_path . '/settings.local.php')) {
   include $app_root . '/' . $site_path . '/settings.local.php';
}

And it contains:

$config['system.performance']['css']['preprocess'] = FALSE;

Issue: Add any changes to bootstrap subtheme at themes/contrib/tekatheme/css/style.css and save. Refresh page, no change. Has to run drush cr each time.

Running drush cr for each CSS edit is not a solution, it's impossible to work like that.

1

This is not a Drupal caching issue. When CSS aggregation is disabled your browser loads the CSS files directly. So caching is between your browser and the web server. To disable caching you can either enable the dev mode in the browser or adjust the headers for CSS files in the web server.

By the way, drush cr doesn't clear CSS in cache. This wouldn't be possible because it is the browser cache. Instead it forces a reload by invalidating the cache-busting query string.

  • Correct answer. It was Nginx configs, add_header and expires rules for CSS and many other asset files. – user3108268 Jul 7 at 7:13
1

Have you tried setting up development.services.yml?

Put this next to your sites.php.

development.services.yml:

# Local development services.
#
# Place this file in the /sites/ directory.
#
# To activate this feature, follow the instructions at the top of the
# 'example.settings.local.php' file, which sits next to this file.
services:
  cache.backend.null:
    class: Drupal\Core\Cache\NullBackendFactory
parameters:
  http.response.debug_cacheability_headers: true
  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: auto_reload
    # 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

Then in your settings.php, or preferrably your settings.local.php add this line:

$settings['container_yamls'][] = DRUPAL_ROOT . '/sites/development.services.yml';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.