Library assets can have configuration data attached to them. If there are no configuration items provided, a simple set of empty brackets is added. Therefore, in each example, lines end with {}.
The following example, taken from core.libraries.yml, adds HTML5shiv:
assets/vendor/html5shiv/html5shiv.min.js: { weight: -22, browsers: { IE: 'lte IE 8', '!IE': false }, minified: true }
Let's take a look at the attributes of html5shiv.min.js:
- The weight key ensures that the script is rendered earlier than other libraries
- The browser tag allows you to specify conditional rules to load the scripting
- You should always pass minified as true if the asset has already been minified
For CSS assets, you can pass a media option to specify a media query for the asset. Reviewing classes that implement \Drupal\Core\Asset\AssetCollectionRendererInterface.