In magento 2, How to set font icon using cdn url.

By default font icon comes from theme folder app/design/frontend/{Package}/{theme}/web/css/source/_theme.less file.

//  Fonts
@mobile-cart-padding : 10px;
@icons__font-path: '@{baseDir}fonts/Luma-Icons';
@icons__font-name: 'luma-icons';

How can we change baseDir with our cdn url to load icon in magento 2.



I haven't done this yet in Magento 2 but I believe it should work:

@icons__font-path: url(**LINK-TO-FONT-URL**) format('**FORMAT-HERE**');

I used Google fonts as a reference of external fonts, you can see how they do it here - https://fonts.googleapis.com/css?family=Open+Sans

  • what will set for LINK-TO-FONT-URL and my fonticon comes from app/design/frontend/{Package}/{theme}/web/css/source folder and its not directly call using url. any suggestion? – Rakesh Jesadiya Apr 27 '16 at 10:49
  • Your LINK-TO-FONT-URL will be the location of the font, for example yourcdn.com/fonts/fontname.woff. I declared the variable inside app/design/frontend/**STORE-NAME**/**THEME-NAME**/web/css/source/_theme.less – Ben Crook Apr 27 '16 at 12:13

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.