Overriding sitemap.theme.css at the theme level

Last updated on
12 December 2018

The sitemap module provides a checkbox on the module settings page that allows a user to disable the CSS that the module provides by default. But what if you are a theme developer and want to ensure that this CSS is never (or always) included?

Add or include the following to your theme's *.info.yml file based on your desired use case.

Use case #1: Never use sitemap.theme.css

libraries-override:
  # Remove sitemap's CSS file
  sitemap/theme:
    css:
      theme:
        css/sitemap.theme.css: false

Use case #2: Always include sitemap.theme.css

libraries:
  # Always use sitemap's libraries
  - sitemap/theme

Use case #3: Override sitemap.theme.css with your own file

libraries-override:
  # Replace sitemap's CSS file with one from my theme
  sitemap/theme:
    css:
      theme:
        css/sitemap.theme.css: css/my-sitemap-theme.css

Use case #4: Always include my own css file when sitemap.theme.css is included

# Extend sitemap.theme: add assets from my theme.
libraries-extend:
  sitemap/sitemap.theme: 
    - mytheme/mylibrary

Detailed documentation for the curious:

Help improve this page

Page status: No known problems

You can: