How to add attributes to links/scripts? How do I add additional attributes values while registering a CSS/JS file?

I want to add a media attribute to one of the CSS links

Example code:

{% do view.registerCssFile(siteUrl ~ 'css/print.css', [ ['media' =&gt; 'print'] ]) %}


The above code produces an Unexpected token "operator" error.
Try this:

{% do view.registerCssFile(siteUrl ~ 'css/print.css', {'media' : 'print'}) %}