Themes have the ability to override libraries using the libraries-override and libraries-extend keys in their info.yml. This allows themes to easily customize the existing libraries without having to add the logic to conditionally remove or add their assets when a particular library is attached to a page.
The libraries-override key can be used to replace an entire library, replace selected files in a library, remove an asset from a library, or disable an entire library. The following code will allow a theme to provide a custom jQuery UI theme:
libraries-override:
core/jquery.ui:
css:
component:
assets/vendor/jquery.ui/themes/base/core.css: false
theme:
assets/vendor/jquery.ui/themes/base/theme.css: css/jqueryui.css
The override declaration mimics the original configuration. Specifying false will remove the asset, or else a supplied path will replace that asset.
The libraries-extend key can be used to load additional libraries with an existing library. The following code will allow a theme to associate a CSS style sheet with selected jQuery UI declaration overrides, without always having them included in the rest of the theme's assets:
libraries-extend:
core/jquery.ui:
- mytheme/jqueryui-theme