1

I want to add the following css to magento 2 at layout.xml in my theme of header blocks

<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.1.0/css/all.css" integrity="sha384-lKuwvrZot6UHsBSfcMvOkWwlCMgc0TaWr+30HWe3a4ltaBwTZhyTEggF5tJv8tbt" crossorigin="anonymous">

But how to add "integrity" and "crossorigin" also?

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
 <head>
 <css src="css/style.css"/>
 <css src="https://use.fontawesome.com/releases/v5.1.0/css/all.css" src_type="url"/>
 </head>
asked Jul 10, 2018 at 6:35
0

1 Answer 1

0

I think you can do it by following

<body>
 <referenceBlock name="head.additional">
 <block class="Magento\Framework\View\Element\Text" name="my_script">
 <action method="setText">
 <argument translate="true" name="text" xsi:type="string">
 <![CDATA[<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.1.0/css/all.css" integrity="sha384-lKuwvrZot6UHsBSfcMvOkWwlCMgc0TaWr+30HWe3a4ltaBwTZhyTEggF5tJv8tbt" crossorigin="anonymous">]]>
 </argument>
 </action>
 </block>
 </referenceBlock>
</body>
answered Jul 10, 2018 at 6:49

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.