cancel
Showing results for 
Search instead for 
Did you mean: 

Typography mixin less compilation

Typography mixin less compilation

Hi Everyone-

 

New to Magento, exploring Magento 2.

 

I'm trying to change the font on my store, following the directions here: http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/css-topics/using-fonts.html

 

My code is:

 

.font-face(
    @family-name:'Courier New',
    @font-path: '@{baseDir}fonts/courier-new-webfont',
    @font-weight: 300,
    @font-style: normal
);

Generates the error in /var/magento/var/log/system.log:

[2015-11-29 23:04:40] main.CRITICAL: 
Compilation from source: 
frontend/SWG/swg-theme/en_US/css/styles-l.less
.font-face is undefined in /var/www/magento/var/view_preprocessed/css/frontend/SWG/swg-theme/en_US/css/source/_typography.less [] []

I noticed that /vendor/magento/theme-frontend-blank/web/css/source/_typography.less uses '.lib-font-face' instead of 'font-face', so I changed the name of the variable in my code to 'lib-font-face'. That allows the css to compile without error, but doesn't change the font on my store.

 

Thoughts?

 

 

3 REPLIES

Re: Typography mixin less compilation

It is impossible to reuse the standard Magento 2 typography in an external extension:

https://github.com/magento/magento2/issues/2265#issuecomment-154351312

https://github.com/magento/magento2/issues/2264

Re: Typography mixin less compilation

Thanks for the response @Dmitry_Fedyuk. I must be missing something, because this answer doesn't seem relevant to my question.

 

I'm not writing an external extension, I'm trying to change the font on my store. When I follow the directions here, it causes the less compiler to have the error mentioned above.  The directions are from the Magento 2 frontend dev docs. Any other ideas as to what's going wrong?

Re: Typography mixin less compilation

Not sure what @Dmitry_Fedyuk is going on about, but I'm having the same issue. Did you find any resolve for this?