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:


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

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

Try this:

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

Then run php bin/magento cache:flush.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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