Search code examples
drupaltheming

libraries-override not working on Drupal 8


I'm trying to figure out how I can remove the default css libraries of Drupal 8 on the theme I'm working on. I tried using libraries-override: to remove a specific CSS but it doesn't seem to be working. The css file is still showing. As you can see the align.module.css is still showing on Google Network Tab. I'm not sure if the method I'm using is deprecated or incorrect

enter image description here

name: Barebones
description: Drupal light
type: theme
core: 8.x

base theme: stable

libraries-override:
  system/base:
    css:
      component:
        /core/modules/system/css/components/align.module.css: false

enter image description here


Solution

  • Maybe help(not tested)

    libraries-remove

    The ability to remove entire libraries.

    libraries-remove:

    1. subtheme/library
    2. core/modernizr

    libraries-override

    The ability to override entire libraries and parts of libraries:

    libraries-override:
      # Replace an entire library.
      core/drupal.collapse: mytheme/collapse
      
      # Replace an asset with another.
      subtheme/library:
        css:
          theme:
            css/layout.css: css/my-layout.css
      
      # Remove an asset.
      drupal/dialog:
        css:
          theme:
            dialog.theme.css: false
      
      # Remove an entire library.
      core/modernizr: false