Magento 2 is not loading the fontawesome cdn library
-
11-01-2021 - |
Question
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..
La solution
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
.
Licencié sous: CC-BY-SA avec attribution
Non affilié à magento.stackexchange