2

I'm trying to load a css library on a magento 2 from cdn:

<css src="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" type="text/css" src_type="url"/>

and to do this I insert this link into:

/app/design/frontend/theme/themename/Magento_Theme/layout/default_head_blocks.xml

and after deployed, cleared the cache and everything, but still not loading it..

2
  • Please share, how you tried to add it in XML.
    – kunj
    Commented May 16, 2018 at 18:43
  • basically I have just added that cdn link into the "default_head_blocks.xml" file..
    – alexcr
    Commented May 16, 2018 at 18:48

1 Answer 1

2

Try this:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <css src="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" type="text/css" src_type="url"/>
    </head>
</page>

Then run php bin/magento cache:flush.

2
  • great, was everything right, I just had to flush the cache and worked, thank you!
    – alexcr
    Commented May 16, 2018 at 19:05
  • Welcome, happy to help you!!!
    – kunj
    Commented May 16, 2018 at 19:07

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.