Problem/Motivation
Currently independent JS libraries (script loaded via its own SCRIPT tag) have the ability to add custom attributes to the tag and this is not the case for CSS libraries of the same type (scripts loaded via their own LINK tag).
# MODULE.libraries.yml or THEME.libraries.yml
bootstrap.cdn:
header: true
remote: https://github.com/twbs/bootstrap
version: '3.3.6'
license:
name: MIT
url: https://github.com/twbs/bootstrap/blob/master/LICENSE
gpl-compatible: true
css:
component:
'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css': { type: external, attributes: { integrity: sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7, crossorigin: anonymous }, minified: true }
js:
'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js': { type: external, attributes: { integrity: sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS, crossorigin: anonymous }, minified: true }
dependencies:
- core/jquery
This would be helpful when including libraries like Bootstrap:
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
Proposed resolution
Add similar functionality to the CssCollectionRenderer class as implemented by the JsCollectionRenderer class.