Stylesheets in Drupal 8: Removing and Overriding
In Drupal 7, there was a stylesheets property for theme .info files, which allowed to
- add new CSS files of a theme or base theme
- override (replace) CSS files that were previously added by a module or base theme in a theme
- remove CSS files of a module or base theme
The facility to override and remove CSS files was partially broken in that it caused the replacement CSS files to be loaded in a different order/position than the original, and all other meta/loading properties of the original CSS file got lost, since the file essentially was re-defined from scratch. This rendered the override/remove facility of the stylesheets property useless for most cases and theme authors had to resort to writing relatively complex PHP code to achieve the correct behaviour.
The problem has been fixed in Drupal 8 by introducing dedicated and separate theme .info.yml file properties for adding, overriding, and removing stylesheets.
Example of new properties:
# Add a new CSS file:
# Override a CSS file:
# Remove a CSS file:
For more information regarding removing and overriding stylesheets in Drupal 8, please see https://www.drupal.org/node/1876600