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' => 'print'] ]) %}

The above code produces an Unexpected token "operator" error.

1 Answer 1


Try this:

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.